JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 16th, 2004, 05:11 AM
gbaia gbaia is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 24 gbaia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
"Check All" checkbox - works, but, it doesn't let me post the form

I have this form with lots of 'checkboxes'.

It worked fine until I implemented the javascript to 'check All'.
when the user clicks on the top checkbox, it selects all the checkboxes in the list.
And it works fine (it does select all the checkboxes when is checked or unselects when is unchecked).

However, since I've done this, the form is not posted anymore!
It doesn't go anywhere...

I've tried using some other code with different ways, but, my JS is far too basic to understand what is really going on...

this is the code - thank you!

<script language="javascript">
function checkAll(allbox) {
for (var i = 0; i < document.territory["Country_ID"].length; i++) {
document.territory["Country_ID"][i].checked = allbox.checked;
}
}
</script>

It's implemented here:

<form name="territory" method="GET" action="territory_country.asp" id="Form1">
<table border="0" cellpadding="5" cellspacing="1" align="center" width="100%">
<tr bgcolor="EEEEEE">
<td colspan="2">
<div class="popUp2"><a href="javascript:void();"><input type="checkbox" name="all" onClick="checkAll(this);">Select All</a></div>
</td>
</tr>

Reply With Quote
  #2  
Old July 16th, 2004, 06:24 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
I presume you've got a submit button and you've closed your form tag?
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old July 16th, 2004, 06:29 AM
gbaia gbaia is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 24 gbaia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes... but, if the checkbox is clicked submit doesn't work

Sure. That's the end of my code: (I can post the whole page if it helps)
Code:
 <script language="javascript">
  function checkAll(allbox) {
   for (var i = 0; i < document.territory["Country_ID"].length; i++) {
 	document.territory["Country_ID"][i].checked = allbox.checked;
   }
  }
  </script>
  <form name="territory" method="GET" action="territory_country.asp" id="Form1">
 <div class="popUp2"><a href="javascript:void();"><input type="checkbox" name="all" onClick="checkAll(this);">Select All</a></div>
 <input type="submit" name="Submit" value="Submit" id="Submit1">
        <input type="hidden" value="<%=territory_ID%>" name="ID">
        <input type="hidden" value="-1" name="submitted" id="Hidden1">
  </form>

When i click on submit button, it doesn't do anything (If check all is clicked). If check all is not clicked then, it works fine and it submits the form.

Thanks!!

Last edited by stumpy : July 16th, 2004 at 07:20 AM. Reason: Place code in code tags - I've combined the code from your first post

Reply With Quote
  #4  
Old July 16th, 2004, 10:14 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Your script makes a reference to the form field "Country_ID," which doesn't exist. Also, I get an error on javascript:void() unless I pass "0" as a parameter. For js debugging, I suggest downloading Mozilla and using the js console to see errors.

Reply With Quote
  #5  
Old July 16th, 2004, 10:34 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
Why is there a anchor (<a>) around the check box? That can't be helping.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > "Check All" checkbox - works, but, it doesn't let me post the form


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap