I have a data collect form that is passing name and email to a database. My fields are firstName, lastName. email and Optin. Optin is using the radioButton component and any value that could be interpreted as yes or no, true or false, 1 or 2 will work.
I actually have 2 isssues, though I set up a field called Optin in the data collect, trace is indicating that the field Optin is not registering.
I have been searching for examples that do something with a radioButton selection besides gotoAndPlay and have found nothing. I currently have this.
//Register each field to be collected
myForm.registerField("F1","firstName.text","String");
myForm.registerField("F2","lastName.text","String");
myForm.registerField("F3","email.text","Email");
myForm.registerField("F4","Optin.data","Data");
flashistListener = new Object();
flashistListener.click = function (evt){
// Add your code here to test which radio is selected?
// you can get this from evt.target.selection.data
// find this by using:
trace(evt.target.selection.data);
// i would then probably use:
if(evt.target.selection.data == "Flashist"){
//do something crazy
}
else if(evt.target.selection.data == "Anti-Flashist"){
//do something crazier
}
//as many else ifs as you want
}
radioGroup.addEventListener("click", flashistListener);
My radio buttons have the instance name Optin, the data is Flashist and Anti-Flashist, the groupName is radioGroup