SunQuest
 
           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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 20th, 2004, 02:24 PM
Pierpont Pierpont is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 14 Pierpont User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Disabling /Enabling multiple form fields

Hi,
I'm trying to enable a number of form fields by selecting a specific checkbox. I
can successfully enable the fields but I can't "Re-disable" them. I have the fields set
to disabled as their default.

Here's the code:

<script>

function Disab (val) {

if(val="nailcbox.checked.yes")
{form.nailstyle[0].disabled=false;
form.nailstyle[1].disabled=false;
form.nailstyle[2].disabled=false;
form.nailheadsize.disabled=false;
form.arm.disabled=false;
form.back.disabled=false;
form.base.disabled=false}
else
{form.nailstyle[0].disabled=false;
form.nailstyle[1].disabled=false;
form.nailstyle[2].disabled=false;
form.nailheadsize.disabled=false;
form.arm.disabled=false;
form.back.disabled=false;
form.base.disabled=false}

}

</script>


What am I missing?
Thanks in advance

Pier










Reply With Quote
  #2  
Old July 20th, 2004, 03:01 PM
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: 7
Send a message via ICQ to dhouston
Could it have something to do with the fact that in both your if and your else, you're setting the fields to false?
__________________
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 20th, 2004, 03:14 PM
Pierpont Pierpont is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 14 Pierpont User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still not working but thanks....

I think that was a result of me changing it a million times to see if something would work.
I changed the second set of falses to true and it still didn't work. Any other ideas?
And thanks for your fast response.

Reply With Quote
  #4  
Old July 20th, 2004, 03:14 PM
BurhanKhan BurhanKhan is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 44 BurhanKhan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
U r using same script in both if and else culse.

U should do this:

function Disab (val) {

if(val="nailcbox.checked.yes")
{form.nailstyle[0].disabled=false;
form.nailstyle[1].disabled=false;
form.nailstyle[2].disabled=false;
form.nailheadsize.disabled=false;
form.arm.disabled=false;
form.back.disabled=false;
form.base.disabled=false;

}
else
{form.nailstyle[0].disabled=true;
form.nailstyle[1].disabled=true;
form.nailstyle[2].disabled=true;
form.nailheadsize.disabled=true;
form.arm.disabled=true;
form.back.disabled=true;
form.base.disabled=true;

}
}

</script>



Burhan

Reply With Quote
  #5  
Old July 20th, 2004, 03:30 PM
Pierpont Pierpont is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 14 Pierpont User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still having trouble....

I tried that and it will enable the form fields but when I re-click the checkbox, I want them to become diabled again. That's the part that's still not working. Could it have something to do with the fact that the form fields are disabled?

Example:

<INPUT type="checkbox" id="nailcbox" name="nailheads" value="nailheads" onClick="Disab()" unchecked>nailheads
<br>
<select name="nailheadsize" disabled>
<option value="">-Choose Size-
<option value="Small">Small
<option value="Medium">Medium
<option value="Large">Large
<option value="Custom">Custom
</select>
<br><br>
Nailhead Location:<br>
<INPUT type="checkbox" name="arm" value="arm," disabled>arm
<INPUT type="checkbox" name="back" value="back," disabled>back
<INPUT type="checkbox" name="base" value="base" disabled>base


I'm totally confused. This seems like it should work.

Reply With Quote
  #6  
Old July 20th, 2004, 03:32 PM
BurhanKhan BurhanKhan is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 44 BurhanKhan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally Posted by Pierpont
I think that was a result of me changing it a million times to see if something would work.
I changed the second set of falses to true and it still didn't work. Any other ideas?
And thanks for your fast response.

Please post your error message, that u encountered.

Burhan

Reply With Quote
  #7  
Old July 20th, 2004, 03:36 PM
Pierpont Pierpont is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 14 Pierpont User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No error message

I don't get an error message. It's weird. The only thing that re-disables the fields is when I reload / refresh the page.

Reply With Quote
  #8  
Old July 20th, 2004, 04:01 PM
BurhanKhan BurhanKhan is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 44 BurhanKhan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Sulotion is:

<script>

function Disab () { // no parameter in the Disab function
if(form.nailcbox.checked)
{
form.nailheadsize.disabled=false;
form.arm.disabled=false;
form.back.disabled=false;
form.base.disabled=false;
}
else
{
form.nailheadsize.disabled=true;
form.arm.disabled=true;
form.back.disabled=true;
form.base.disabled=true;
}
}


</script>


Only replace your script with this one and tell me about this.

Burhan

Reply With Quote
  #9  
Old July 21st, 2004, 07:09 AM
Pierpont Pierpont is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 14 Pierpont User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You are a genius

It worked. Thanks alot.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Disabling /Enabling multiple form fields


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway