PDA

View Full Version : Formmail


desertstream
03-16-2004, 10:51 PM
I am a completely inexperienced actionscripter and need some help. I have gotten a form to work with a modified version of Matt's formmail. The text passes into an email that is sent to me. The problem is that I can't get the check boxes on the form to pass the true or false state of the box into the email. The code I have is as follows where the checkboxes are 'six', 'nine', 'onemil', and following. Please take it easy on me, I am clueless!!!

function sendEmail() {
var message = new LoadVars();

message.firstName = firstName.text;
message.lastName = lastName.text;
message.spouseName = spouseName.text;
message.email = email.text;
message.phone = phone.text;
message.address = address.text;
message.city = city.text;
message.state = state.text;
message.zip = zip.text;
message.country = country.text;
message.referral = referral.text;
message.six = six.text;
message.nine = nine.check;
message.onemil = onemil.check;
message.onethreemil = onethreemil.check;
message.club = club.check;
message.golf = golf.check;
message.sports = sports.check;

splict
03-16-2004, 11:49 PM
Where did you see .check being used? I'm not sure what it might be on earlier versions of flash but in 2004 (don't know what you are using) you need to use .selected to see if a box is checked or not. Check out the manual, it should have the code in there if you are using MX and it is, for some reason not the same.

-splict

desertstream
03-17-2004, 08:37 AM
I never saw checked being used, I just couldn't find the right tag in the action script dictionary. I will give the .selected tag a try. Thanks.
Jason

desertstream
03-17-2004, 05:41 PM
I tried the .selected tag and it did not work. Any other suggestions?

splict
03-17-2004, 10:40 PM
I stand by my selected property suggestion. :D Are you using flashMX2004? If so, this code would demonstrate that it works, just drag a checkbox to the stage and give it the name myCheck:
myLV = new LoadVars();
myLV.myCheck = myCheck.selected;
myLV.sendAndLoad("http://fakehost", myLV, "GET");
Notice that this outputs:
Error opening URL "http://fakehost?myCheck=false"
or myCheck=true, depending on if it was checked or not. Maybe the problem is how you are interpreting it in your serverside file?

What serverside language are you using? what flash version are you using? what is your serverside script? (I am not familiar with 'Matt's formmail.')

-splict

splict
03-17-2004, 10:57 PM
I saw on the other thread that you are using MX. I am not positive how it was on MX (how easy it is to forget :rolleyes: ) but try myCheckbox.getValue() instead of .selected.

-splict

TheBuzz
03-23-2004, 11:11 PM
Desertstream,

I feel your pain when working with components. But I found some really good tutorials on how to pull out info from components. And the syntax should be the same for displaying information as it is to send it serverside (could be wrong, but under that impression :) ).

Check out this tutorial on MX04components.

http://www.actionscript-toolbox.com/fmx04_components.php