473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

enabled fields based on checkbox value

i hv this code..but it doesn't work..the idea is to make the combo enabled if checkboxes with value 1 is selected.can anyone help me with this..is it bcoz of my function?? thanks in advance..


<tr>
<td><input class="text field" type=radio value="0" name="type" onClick="chkBox();">0 &nbsp;
<input class="text field" type=radio value="1" name="type" onClick="chkBox();">more<td></td>
<td><SELECT class="text field" name="Experience" disabled="true">
<option value="" selected></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</SELECT>Year(s)</td>
</tr>



below is the function

function chkBox()
{
if(document.addForm.type.checked=="0")
{
document.addForm.Experience.disabled=true;
}
else(document.addForm.type.checked=="1")
{
document.addForm>experience.disabled=false;
}
}
Apr 1 '08 #1
2 1196
shweta123
692 Expert 512MB
Hi,

You can make a little modification in your code to make it work.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.   function chkBox()
  4.    {
  5.     if(Not document.addForm.type.checked)
  6.     {
  7.        document.addForm.Experience.disabled;
  8.     }
  9.     else(document.addForm.type.checked)
  10.     {
  11.        document.addForm.experience.disabled = false;
  12.     }
  13.  
i hv this code..but it doesn't work..the idea is to make the combo enabled if checkboxes with value 1 is selected.can anyone help me with this..is it bcoz of my function?? thanks in advance..


<tr>
<td><input class="text field" type=radio value="0" name="type" onClick="chkBox();">0 &nbsp;
<input class="text field" type=radio value="1" name="type" onClick="chkBox();">more<td></td>
<td><SELECT class="text field" name="Experience" disabled="true">
<option value="" selected></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</SELECT>Year(s)</td>
</tr>



below is the function

function chkBox()
{
if(document.addForm.type.checked=="0")
{
document.addForm.Experience.disabled=true;
}
else(document.addForm.type.checked=="1")
{
document.addForm>experience.disabled=false;
}
}
Apr 1 '08 #2
hi~~thanks..
it works...
Apr 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: LRW | last post by:
Subject line confusing? The whole thing is confusing to me. OK, I think the root of my problem, aside from mental, is array based...but I'm not even sure what I want to do is even possible. So if...
2
by: HolaGoogle | last post by:
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field...
6
by: ML.Steve | last post by:
Hi, There are lots of posts on this subject but after a couple of hours of going though them I still can't get a number of fields to be disabled when a checkbox is ticked. Basically I have a...
5
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
5
by: stellstarin | last post by:
I have a html where fields are created and added dynamically on the client side. I use the AppendChild() call to create fields dynamically. On submit i try to get the value for all the...
2
by: TGEAR | last post by:
there is one check box and if it is checked, then shows several fields underneath; otherwise, several fields are hidden. the default is unchecked. anyone can share the code for this function? ...
6
by: Brandon McCombs | last post by:
Hello, I have a Form that contains some configuration information. One of the settings is for SSL. There is a checkbox that I want to check to make 2 textboxes un-editable so that a user can...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
45
by: dizzydangler | last post by:
Hi, I'm new to access (2007, running on XP), but I've gotten some great help from this site on my project so far. However, the more I know, the more complex the problems seem to become.... I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.