The Form object is similar to the Container object but this one is intended to allocate user input objects such as Text Input, Text Area, etc. so you can send later the information to a server.
This object corresponds to the <form> HTML tag.
Every Form object has special properties necessaries to send the data to the server:
- action: specifies the URL where the information should be sent. Usually a server script as myscript.php located on a local or remote hosting service.
- method: select GET method to send the information as a part of the URL, or POST otherwise. Use allways POST unless you have a good reason to use the GET method.
- target: Left it empty unless you want to send the information trough an iFrame (use the iFrame name) or through a new Browser Tab ( _blank ).
Note that you will need to add some data input objects to the Form object and also a Form Submit Button to allow the user to actually send the data.
This object has three special events you can use to add scripting commands to them.
Doubleclick one Form object instance in the workspace to enter the script editor, choosing between the different events through the tabs you will find at the bottom.
- submit: this event fires when the Form Submit Button is pressed.
- success: the data has been sent succesfully.
- fail: there has been some error sending the information to the server script.
The success and fail events use two special variables [Status] and [Data].
[Status] stores the http status code returned from the server. Usually it should be 200 if everything works fine. For more information on status codes visit:
[Data] wil contain the data sent back from the server script, so you can process it.
For more information on this subject, please open the included sample App located at Documents\VisualNEO Web\SampleApps\FormSubmit.
It is a complete sample with different data input objects, where the user information is validated before being sent to the server (submit event).
In the same folder you can find the simple .php script code used in this sample App, we have installed in a remote web server.