Hi
I am using Flash M2004 Pro to build a contact form using the new components. The problem is that when it comes to validating the form it work with "email.text" and "question.text" (which are text fields), but I can not get it to work with radio buttons or list boxes.
myButtonListener = new Object();
myButtonListener.click = function()
{
var selectedRadioButton = gender.selection;
var theSelectedItem = age.selectedItem;
if(email.text == ""{
var Alert = mx.controls.Alert;
Alert.show("Please enter your emaill address."
}else if(question.text == ""{
var Alert = mx.controls.Alert;
Alert.show("Please enter your question."
}else if (selectedRadioButton.label ""{
var Alert = mx.controls.Alert;
Alert.show("Please choose your gender."
}else if (theSelectedItem.label == ""{
var Alert = mx.controls.Alert;
Alert.show("Please choose your age."
}else{
myData = new LoadVars();
myRequest = new LoadVars();
myRequest.onLoad = function(message) {
trace(message);
};
//dataholder
myData.email = email.text;
myData.question = question.text;
myData.gender = selectedRadioButton.label;
myData.age = theSelectedItem.label;
myData.sendAndLoad("mailer.php", myRequest, "POST"
gotoAndPlay("submitted"
};
};
submitBtn.addEventListener("click", myButtonListener);
Thanks in advance
I am using Flash M2004 Pro to build a contact form using the new components. The problem is that when it comes to validating the form it work with "email.text" and "question.text" (which are text fields), but I can not get it to work with radio buttons or list boxes.
myButtonListener = new Object();
myButtonListener.click = function()
{
var selectedRadioButton = gender.selection;
var theSelectedItem = age.selectedItem;
if(email.text == ""{
var Alert = mx.controls.Alert;
Alert.show("Please enter your emaill address."
}else if(question.text == ""{
var Alert = mx.controls.Alert;
Alert.show("Please enter your question."
}else if (selectedRadioButton.label ""{
var Alert = mx.controls.Alert;
Alert.show("Please choose your gender."
}else if (theSelectedItem.label == ""{
var Alert = mx.controls.Alert;
Alert.show("Please choose your age."
}else{
myData = new LoadVars();
myRequest = new LoadVars();
myRequest.onLoad = function(message) {
trace(message);
};
//dataholder
myData.email = email.text;
myData.question = question.text;
myData.gender = selectedRadioButton.label;
myData.age = theSelectedItem.label;
myData.sendAndLoad("mailer.php", myRequest, "POST"
gotoAndPlay("submitted"
};
};
submitBtn.addEventListener("click", myButtonListener);
Thanks in advance