Ok, I'm officially a moron. I can't figure out how to assign a variable to a combo box...
It's probably a brain fart more than anything.
Printable View
Ok, I'm officially a moron. I can't figure out how to assign a variable to a combo box...
It's probably a brain fart more than anything.
Not sure what you mean. You want to populate the combobox with variables? Have items that are clicked in it define a variable? Or something other?
I'm officially a moron who can't read ;)
Let me put it this way.
I have a combobox with two items in it.
Male
Female
I want to assign the variable "gender" to the combobox. So that when the form is sent it sends the choice.
Gotcha. In Frame 2, in the onChange handler, you can do anything with the value you want where I commented it.
Why are there two boxes in your example?
Nevermind, I think I figured it out.
The two boxes are because you're assigning the variable to the Text box right?
Could I simply do this?
code:
// Male = 1
// Female = 2
gendervar= combobox1.getValue();
if (gendervar == 1){
gender = "Male";
} if (gendervar == 2){
gender = "Female";
}else{
gender = "";
}
No....that script will fail.
I think a combobox is not what you should use for what you are doing. You should use two checkboxes. One for male, one for female. When checked have it set that variable name (the same variable name you are using in your POST for gender) to "Male" or "Female".
Your example above, even if it were formatted right, would need to be part of an (onEnterFrame) routine that constantly checks the value of that one field....which is overkill for a form that most likely has more than one variable being sent out.
If this is confusing I will have to code an example.
EDIT: I see bret posted something for you in another thread so you should be good right?
Worst case scenario...if you can't figure out how to post variables....I have a download at my place that although it is a login form, will show you how to use loadVars.....POST only the fields you want...and how to get a result using sendAndLoad (Almost all forms return a result to notify the user of successful submission).
LOL, it wasn't even formatted correctly?
I'm going to make you something. I can't test it because I don't enable the mail server on my server (hate the stuff) but the front end will be easy to tie to your backend.
Maybe it should be noted that I use Jack's Formmail.php to process any email forms.
Looks like a good mail form processor. I would modify the error message to a variable format that way your flash form will recieve that message and you can act accourdingly.
Rework this part
Code:function print_error($reason,$type = 0) {
build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
// for missing required data
if ($type == "missing") {
if ($missing_field_redirect) {
header("Location: $missing_field_redirect?error=$reason");
exit;
} else {
?>
The form was not submitted for the following reasons:<p>
<ul><?
echo $reason."\n";
?></ul>
Please use your browser's back button to return to the form and try again.<?
}
} else { // every other error
?>
The form was not submitted because of the following reasons:<p>
<?
}
echo "<br><br>\n";
echo "<small>This form is powered by <a href=\"http://www.dtheatre.com/scripts/\">Jack's Formmail.php ".VERSION."</a></small>\n\n";
exit;
}
Yeah, the script has been EXTREMELY reliable and so far, secure. I've made some changes to allow me to test things without uploading to the server other than that it's got some pretty cool features.
I don't use the missing_field_redirect that often. I figure, if I don't need the field, might as well just leave it out of the form.
I'll try the changes you've noted and see what they do. I'm pretty curious now.
OK....
Try this:
http://sandbox.blogdns.com/loadvars_mailform.swf
Try it. It also traps empty fields. I have it write the variables to a text file also so you can see it indeed gets all of them. You can see the variables written here:
http://sandbox.blogdns.com/mailform.txt
Whenever I make anything that posts to php I test using a text file. This lets you confirm the variables are being sent if they are not being sent to something obvious(like a database). It's a good habit to get into and with mail forms it definitely helps.
I'm not a big fan of wasting my time so if you already have a solution I'll just make this one of my downloads.
I don't like conflicting with a mod when they are posting a solution. I'll add this to my downloads for all platforms in case users want it.
To many cooks making this stew. Peace.
cool, I'll check out the downloads.
Is this the same answer to the "change the text variables to instances"?
Yeah...no more loadvariables and variable names for me.
This is loadVars with instance names.
Well, good. Then I look forward to the download and learn how you did this.
I see, the write to the text file was just for the example. In my form, I'll actually have it send the form data to the formmail.php right?Quote:
Try it. It also traps empty fields. I have it write the variables to a text file also so you can see it indeed gets all of them. You can see the variables written here:
Yeah...that coding is there it just doesn't send me any mail because the "mail" command is disabled on my server. The coding is there...that section you will remove in the php (and save it so you can always do that to test).
I would attach the file here but I almost got banned from Flashkit last year and one of my resolutions is to not trap my hard work as an attachment to a forum I may end up banned from. This year I worry about me first and the user second.
Huh, interesting.
Alright, just let us know when the download is available. Thanks for the help.
Don't run off cause of me... :) Mod just means I have to spank ya if you get out of line, it doesn't mean I;m a KM expert (I'm not)Quote:
Originally Posted by Chris_Seahorn