I am creating a Flash Form Application. I have three forms with various components that are populated by ASP scripts. Some fields on the forms need to be mannually filled out by the user. I want to validate the data before it is saved to the database. I have noticed that text fed into the fields from the ASP script are not problem but if I type text into a field (textInput component) and then click a button (i.e. submit button) the data doesn't seem to exist.
Here is a working example:
Create a new Flash Form Application (FLASH MX 2004 Professional)
Create one additional form beneath the default "application" form. You should have form1 and form2 as well as the main "application" form.
On form1 place a TextInput Component. Give it an instance name time_ti
On form2 place a Button Component. Give it an instance name submit_btn
On form1 create a new layer in the time line. Call it Actions. Lock the layer.
Open the actions panel and enter the following script:
//begin script
//time_ti listener
timeTextListener = new Object();
timeTextListener.handleEve
nt = function(evt) {
if (evt.type == "enter") {
trace("You have entered some text");
trace("Length: " + time_ti.length);
trace("Text: " + time_ti.text);
}
};
time_ti.addEventListener("
enter", timeTextListener);
//submit_btn on click
function click(evt) {
trace("Length: " + this.time_ti.length);
if (this.time_ti.length== 0) {
trace("Text: " + this.time_ti.text);
trace("You did not enter a time!");
} else {
trace("Length: " + this.time_ti.length);
trace("There is a time in the field");
}
}
this._parent.form2.submit_
btn.addEve
ntListener
("click", this);
//end script
However, on the form I am working with the return information for the script above is:
++++++++++++++++RETURN DATA IN PROBLEM APPLICATION+++++++++++++++
++++++++++
+++
//text returned when enter key is pressed on the keyboard after adding data to the text_ti TextInput component.
You have entered some text
Length: 4
Text: 1600
//text returned after pressing submit_btn.
Length: 0
Text:
You did not enter a time!
Can anyone tell me why I can't see what was entered when I click the submit button?