Reply
How can I Disable a Form Field?
Old 01-10-2008, 01:04 PM How can I Disable a Form Field?
SKP
SKP's Avatar
Novice Talker

Posts: 9
Name: Sandy
Location: Iowa
Hi,
I know how to disable a field if a checkbox is checked, but I need to disable it if another text field has a "0" in it. For instance...
Let's say I have 2 fields - bikes and redbikes.
If I say I have 2 bikes I want to know how many are red. But if I have "0" bikes, I want to disable the redbikes field (since I already know I have no red bikes).
Can anyone give me an idea how to do this?
Thanks for your thoughts.
SKP is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 01-10-2008, 02:42 PM Re: How can I Disable a Form Field?
chrishirst's Avatar
Super Moderator

Posts: 11,506
Location: Blackpool. UK
if (document.formname.bikes.value == 0) {
document.formname.redbikes.disabled = true;
}
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-10-2008, 04:19 PM Re: How can I Disable a Form Field?
SKP
SKP's Avatar
Novice Talker

Posts: 9
Name: Sandy
Location: Iowa
Where do you call the function from, bikes? And how? By OnFocus or OnChange?
Sorry I'm so dumb about this. I'm trying to teach myself this stuff. And I've seen lots of different ways to call functions.
SKP is offline
Reply With Quote
View Public Profile
 
Old 01-11-2008, 03:18 AM Re: How can I Disable a Form Field?
chrishirst's Avatar
Super Moderator

Posts: 11,506
Location: Blackpool. UK
it all depends on how the text field is populated.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to How can I Disable a Form Field?
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11773 seconds with 13 queries