Skip to main content
Known Participant
December 18, 2007
Question

Populating dynamic text field with form data from previous frame

  • December 18, 2007
  • 1 reply
  • 283 views
I've got a dynamic text field (name) and I'd like to populate it with the values from two fields in a form from a previous frame. Does anyone know how to transport user-input values from one frame to another frame?

Here's the code I'm using to capture the user-entered data:

var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = "Thank you for completing this training module.";
} else {
result_ta.text = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.fname = fname.text;
send_lv.lname = lname.text;
send_lv.email = email.text;
send_lv.sendAndLoad(" http://distance.uaf.edu/ferpa/process.php", result_lv, "POST");
gotoAndStop("certificate");
};
submit_button.addEventListener("click", submitListener);

Is there any way to capture the values from the fields 'fname' and 'lname' (which are instance names not variable names)? Note: I had to make them instance names in order for the code to be accessible to LoadVars() and hence to my php processing script.

thanks,
sage
This topic has been closed for replies.

1 reply

Participating Frequently
December 19, 2007
well you could have used variable names but I wont get into that. but you then define it in send_lv so you should be able to use that for the next frame. so your textfield.text = send_lv.fname+" "+send_lv.lname;
Known Participant
January 3, 2008
Keep in mind I'm not using a textfield component, just a dynamic text box with the variable 'name' applied to it. Also, doesn't it matter that send_lv.fname was created within the LoadVars() method?

At any rate, I tried doing what you said with the following code:

name = send_lv.fname+""+send_lv.lname;

However, what i end up getting in the textbox is 'undefinedundefined'. I can't apply variables to the text fields instead because then it won't process the data to my php script.

Any other suggestions?