When all the data entered into the form is valid, the actions in the else part of the validateForm() function including this section of script are executed.
The first four lines of the script place the data in the various TextInput instances into the registrationData object. The last line sends this data to a server-side script.
For the last line of script, you should insert the URL to a script on your server for processing the data. Or, if you simply want to do a final test of your code, use this URL: http://www.derekfranklin.com/cftemplates/notsosoft.cfm. The ColdFusion page at this URL will send you email containing the validated data.
The else part of this script already had an action that would send the application to the Confirm label automatically when all the data entered was valid. Because the application is now set up to send data to a server, let's change this functionality a bit so that the application only moves to that frame label after a response has been received from the server, indicating that the submitted data has been received and processed.
Remove the line of script in theelseleg of thevalidateForm()function that readsgotoAndStop("Confirm")and insert the following script just above thesendAndLoad()method call:
This script will move the application to the Confirm label when a server response has been sent back to the registrationData object. Let's do one final test.
Before testing, make sure that the URL specified in the sendAndLoad() method discussed in Step 3 contains a server-side script for handling the incoming data.
Choose Control > Test Movie.
If you enter valid data into the form fields and click the Submit button, the application should send the data to the specified server-side script for processing, and eventually move the application's timeline to the Confirm label after a response has been received from the server.
Close the test movie to return to the authoring environment, and save this file asvalidate7.fla.
This step completes the exercise and this lesson. The great thing about the way we've set up this project's validation process is that it's dynamic. To analyze additional rules or validation points for any of the text fields, all you have to do is add more conditional statements to the appropriate function. The validation process can grow as your needs grow.