MarcDykstra Posted March 12, 2014 Report Share Posted March 12, 2014 I have a form that currently uses Dropdowns and want to change them to Radio buttons. Not a biggie, but I'm not sure what I need to change on my script to make it work. It seems that the radio button has 2 fields, so I think I have to somehow choose which is selected? I'm a bit of a novice, so any help would be greatly appreciated. Here is my current script: <SCRIPT LANGUAGE="JavaScript">function calculate(){var v_q1 = parseFloat(document.getElementById("InsertRecordSec1Q1").value);var v_q2 = parseFloat(document.getElementById("InsertRecordSec1Q2").value);var v_q3 = parseFloat(document.getElementById("InsertRecordSec1Q3").value);var v_q4 = parseFloat(document.getElementById("InsertRecordSec1Q4").value);var v_q5 = parseFloat(document.getElementById("InsertRecordSec1Q5").value);var v_q6 = parseFloat(document.getElementById("InsertRecordSec1Q6").value); var v_Sec1total = (v_q1+v_q2+v_q3+v_q4+v_q5+v_q6); document.getElementById("InsertRecordSec1TotalScore").value = Math.round(v_Sec1total); Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 14, 2014 Report Share Posted March 14, 2014 A Radio button includes multiple options. Each option has an associated id. The id is a name followed by a number: InsertRecordFIELDNAMEX X is the radio button option order and starts from 0. It increments based on the order of the option. For example if your radio button has three options: Red, Blue, Green Red is referenced by InsertRecordFIELDNAME0 Blue’s ID is InsertRecordFIELDNAME1 And the third option Red is referenced by InsertRecordFIELDNAME2 Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 14, 2014 Report Share Posted March 14, 2014 You can use developer tool to inspect the code and get the idea. My favorite is firebug which is an add-on for firefox Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.