![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Knowledge Base Most common error and how to trouble shoot them off |
![]() |
|
Radio button selected value
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Fixed Error!
Posts: 141
Location: Chennai
Join Date: Feb 2007
Rep Power: 2
IM:
|
this.form.areaID.options[this.form.areaID.selectedIndex].value If I were wanted to do the same, retrive the selected value for <RADIO> in a single line javascript, how? |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Fixed Error!
Posts: 141
Location: Chennai
Join Date: Feb 2007
Rep Power: 2
IM:
|
say you have two different radiobuttons i.e <input type="radio" name="rad1" value="1"> and <input type="radio" name="rad2" value="2"> then their values can be recieed by document.formemail.rad1.value and document.formemail.rad1.value.. but say you have multiple radio buttons with same name i.e <input type="radio" name="commonrad" value="1"> and <input type="radio" name="commonrad" value="2"> now this has become an array. so then you have to run a loop to get the value.. i.e document.formemail.commonrad[0].value will give 1 and document.formemail.commonrad[1].value will give 2 also you will have to check first which one is checked. to avoid all this i had put an hiddenfield and just assigned the value of the radio button checked so that it can be accessed in a single line of code... |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|