Service receiving the variables in a form.
Class Form( [instance] ) from \ nest.Service(( instance))
instance | Instance of the service. |
This service is a useful generator and manager of web forms.
Writing a web form is relatively easy, but automation of web forms is a complex matter. Among the things that a modern web site needs to do with form is:
The Nest Form service can have also the role to bind with a data entity, completing the data manager services.
Properties | |
check | Config - Global check on the form. It's a function with the following prototype: |
skin_performed | Skin - Used when the operation is finally performed. This usually closes an update; the caller will want to display "operation complete, please return to main page" or similar messages. |
skin_result | Skin - Skin used to render the "result" message in the main skin. The default skin shows the result message in a of id result_[css_id], where css_id is the CSS id set in configuration for this service. |
stored | Service -- Last store operation Status. |
Config - Global check on the form. It's a function with the following prototype:
check( form )
where form is this instance.
The function has the main role of checking the consistency of the form as a whole, veryfing consistency of multiple fields (i.e. repeated passwords) and deciding if the form as a whole is valid.
To signal anomalies, the function may use the Field.failure entry, or set the service Form.result field.
If the form has a DBEntity set in Form.entity, then check() may just return true if the form is allowed to proceed, or false to stop the form data from being processed. Notice that if a previusly called Field.check function was already signaling some problem, the return value of this function will be ignored.
This function may also store or otherwise process the data on its own; in this case, it should properly set Form.result and Form.stored (and also Service.skin, if consistent), and it should return false to prevent further processing.
Returning false won't cause any error status to be actually set, it just prevents the form from being automatically stored in a given Form.entity.
In any case, Form.stored should be used to tell the application (and the calling page) about the success or failure of form processing result.
Skin - Used when the operation is finally performed. This usually closes an update; the caller will want to display "operation complete, please return to main page" or similar messages.
The default skin just displays the contents of the "result" field.
To "disarm" it, the caller should just set it to "skin", so that the main skin gets loaded; this means that the "result" field will be renderd as a part of the form, which will be proposed again with the updated data.
The default skin shows the result message in a
Skin - Skin used to render the "result" message in the main skin. The default skin shows the result message in a
Service -- Last store operation Status.
Will be true if self.result is an OK message, false if self.result is an error message. It is automatically set by the form when trying to save the form data on a persistent DBEntity; elsewhere it's nil, and isSet will return false.
The variable could also be used by the form check function (Form.check) to declare if a self-managed storage operation was successful or not.
The status is set during the startup phase, so the host page can configure itself and decide which path to take depending on what happened.
The variable is not shared with skins.