Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Javascript

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 09-19-2011, 09:13 PM   #1
ncjbhd
Registered User
 
Join Date: Jul 2011
Posts: 262
How can I Disable a Form Field?

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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
ncjbhd is offline   Reply With Quote

Old 11-21-2011, 05:29 AM   #2
Spoint_Vinil
Moderator
 
Join Date: Sep 2011
Location: INDIA
Posts: 250
you can use disable property of field you re using fir this purpose.
see the code seems like this


document.form_1.text_1disable=true
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Spoint_Vinil is offline   Reply With Quote
Old 10-19-2015, 11:59 PM   #3
smmexpertss
Registered User
 
Join Date: Sep 2015
Location: UK
Posts: 447
An HTML form with a disabled input field:

<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname" disabled><br>
<input type="submit" value="Submit">
</form>
smmexpertss is offline   Reply With Quote
Old 12-15-2015, 10:56 AM   #4
etechstack
Registered User
 
Join Date: Oct 2015
Posts: 40
Set attribute as disabled in input tag. if you want to disable on runtime use jquery attr to disable attribute by using selector id or class.

JPG to PNG Converter
Image Resizer
LIST OF ALL CMD COMMAND

LINK GODADDY SUBDOMAIN TO TUMBLR
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by etechstack; 12-15-2015 at 10:59 AM..
etechstack is offline   Reply With Quote
Old 12-23-2015, 02:40 AM   #5
varunindia88
Registered User
 
Join Date: Jun 2013
Location: New Delhi
Posts: 183
The impaired trait is a boolean quality.

Whenever present, it determines that the <input> component ought to be impaired.

An incapacitated info component is unusable and un-clickable.

The debilitated credit can be set to keep a client from utilizing the <input> component until some other condition has been met (like selecting a checkbox, and so forth.). At that point, a JavaScript could uproot the incapacitated esteem, and make the <input> component usable.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
varunindia88 is offline   Reply With Quote
Old 01-01-2016, 04:40 AM   #6
James More
Registered User
 
Join Date: Jan 2016
Posts: 28
To implement this functionality you can use jquery and check if the filed is zero than other field will be disable.Moreover you can easily find the examples of this over google.
James More is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:19 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.