Need help please…new to JS
On Form submission, I am trying to pass a variable (var radioValue, which is the RadioButton selection) as Opt Label in the _gaq.push event tracker (google analytics)as follows
onclick=“_gaq.push([‘_trackEvent’, ‘Visitor’, ‘Submit’, radioValue]);”
However radioValue value is not getting passed
Code snippets are attached below. Not sure whether the problem is in the JS function or whether i am calling the var incorrectly in the _gaq.push script…Thank you
The radioValue is captured in the overall form validation function as below.
Hari
(in HTML head)
/////other overall form functions
var radio_choice = false;
for (counter = 0; counter < document.form.RadioGroup.length; counter++)
{
if (document.form.RadioGroup[counter].checked == true){
radio_choice = true;
radioValue=(document.form.RadioGroup[counter].value);
}
}
if (!radio_choice)
{
alert(“Please select again.”);
return (false);
}
/////other overall form functions
RadioButton Input script (in HTML body)
<input name=“RadioGroup” value=“abc1” type=“radio” />abc1</td><td> </td></tr>
<input name=“RadioGroup” value=“abc2” type=“radio” />abc1</td><td> </td></tr>
<input name=“RadioGroup” value=“abc3” type=“radio” />abc1</td><td> </td></tr>