This class is used to build and render the form.
It builds a form by creating FormElement objects which have automatic validation. It leaves the layout of the form up to the child class. It has a mechanism in place to automagically show a confirmation 'page' after the data has been submitted and validated. It also provides a hook for any 'back end' validation of data. Finally, it provides a function for handling the action of the form, which only gets call after ALL validation has passed.
Functions:
form_init_elements() - This function is used to build the FormElement objects that will be used by the form. This function is called EVERY time the FormContent class is instantiated. After you create the FormElement, you call the FormContent::add_element() method, to add the FormElement object to the form. You will then call the 2 methods FormContent::element_label() and FormContent::element_form() to get access to the FormElement's label and form field respectively.
form_init_data() - This is called only the first time the form is encountered. It Allows you to populate the FormElements with data from a DB for example. You would use FormContent::set_element_value() or FormContent::set_hidden_element_value() inside here.
form() - This is the method that gets called to build the layout for your form. Typically you use a table and add the label in the first <td> and the form field itself in the 2nd <td>. So there are 2 methods in the FormContent object that allow u to get access to the FormElements label, and form field. FormContent::element_label() and FormContent::element_form().
form_backend_validation() - This method enables you to do any "back end" validation of data. Such as, check for a duplicate in the DB on a create/new form. This is called after the FormElement's validation methods have passed.
form_action() - This method is called after ALL validation was successfull, including each FormElement object's validation methods, as well as the FormContent::form_backend_validation()
Located in /form/FormContent.inc (line 77)
Class | Description |
---|---|
StandardFormContent | This is a child of the FormContent class to provide a 'standard' look and feel for forms. |
SampleForm | This is the Class that handles the building of the Form itself. It creates the Form Elements inside the form_init_elements() method. |
AccountForm | This is the Class that handles the building of the Form itself. It creates the Form Elements inside the form_init_elements() method. |
MasterSlaveForm | This is the Class that handles the building of the Form itself. It creates the Form Elements inside the form_init_elements() method. |
This holds how many actions we have
for this form content
The message that is set
during the form_action
The action to take opon clicking
the "Cancel" button
This holds the default css class for form field label text.
This holds the array of
non-hidden elements
This is the css class used
for fields that have an error
index names of all of the file form elements (if any).
This is the FormValidation object
used to validate the form elements
The onsubmit value for the form
tag. This is used by form action elements to add disable on submit
The form errors table title
Holds the width (if any) of the errors table that will be rendered. If the value is null, the $this->_width value is used instead.
This holds the name of the form
for js that needs it
The onsubmit value for the form
tag. FormElement childs can automatically add to this by implementing the form_tag_onsubmit() method
flag to let the FormProcessor
object know this form has a confirmation page that is required
Flag to mark this as having a
File Form Element (child of FEFile)
This holds the array of
hidden form elements used in this form
Indicates this entire FormContent is in readonly mode. This forces all of the FormElement to be in readonly mode.
The form Element's flag to add the : character at the end of the label.
marker for the required field
Text to show denoted required fields for the form.
Automatically strip slashes from
form values?
Holds the width to be used for the
error table DEFAULT: 95%
This function adds a form submit button with the appropriate action.
This function adds a form submit button with the appropriate action.
build a cancel button with a url to go to
This method is used to create a new error element during the call to form_action(). This enables us to do error handling during a transaction into a DB.
This function adds a submit button that can have any label. It just makes the _form_action a hidden field.
NOTE: you can only do this ONCE per form.
This method is used to add a hidden form field
This function adds an action as an image to submit the form.
This method allows the child to ovveride the default confirm data. By default the form_confirm() will show ALL FormElements. This is prolly not good in case of a form where a password exists.
This method is used to test if the element exists in a form
This method returns the actual form object that renders the form field.
Such as an INPUTtag object.
This method returns the label object for a visible form element.
This method builds the html form.
It is up to the child class to define the layout of the form and return it in a phpHtmllib container.
This method handles the
action (submit button) that was submitted. This method only gets called AFTER all data has been validated. This includes the backend validation. If the form has the confirmation on, then this method will be called after the confirmation has been accepted.
NOTE : return TRUE if the action was succesfully handled. If FALSE is returned, the form will be displayed again with the error message.
This method is called after the FormElements
have all been validated, and the form_confirm has been confirmed. It enables the form to validate any data against a DB or other backend processing. This will always get called before the form_action method is called to ensure that all form data is valid before form_action() is called.
This function is used to show an intermediary confirmation page. Use this function to show a confirmation of the data that was submitted by the user.
This will get called after all of the form data was successfully validated. All of the form data will automatically be created as hidden form fields. All you have to do is show the data, and a confirm submit button.
This function is used to render the error table for the form. The error data comes from the FormProcessor or the FormValidation.
NOTE: You can override this method to show a customized error message(s)
This method is called by the
Form Processor to allow this class to do any fetching of data to prepopulate the form field values. You typically use this to read data from a DB.
This method is only called once when the form is first hit.
NOTE: you should build the data and save it in $this->_init_data
This method is what is called to build the list of FormElements that will be used by this form.
This method is called when the form_action() was successfull, and the form wants to render some kind of message
Get the current status of the action.
This function returns a submit action by label
return the values of all visible form elements as an array
This function returns the default css class used for NON error text.
This method returns the FormElement based on the label.
This method is used to get the value for a non hidden element
This method returns an array of errors for all the errors.
This method returns the width of the form errors table.
By default it is supposed to be the same width as the form itself.
This method is a helper method to get the FormElement's tabindex.
This method is used to get the value for a hidden element
This function is used to get the required field marker
This gets the value of the confirmation flag.
which tells the caller that this object has/doesn't have a required confirmation page.
This method returns the label object for a visible form element.
Is this element in read only mode?
This method lets you provide any javascript that is associated with the form content.
The FormProcessor will automatically call this and wrap it in a script tag.
This method allows this class to do any data munging prior to the form_confirm method being called @ render time.
Save the action for the form
This sets the action message.
This is called from withint the form_action() method
This method sets the javasript action
to be taken when the cancel button is clicked. Calling this method w/ a non NULL value automatically enables the Cancel button.
This method sets the flag to have ALL of the FormElement's labels be appended with a : character. Some folks like this for some completely unexplained reason.
This sets the $this->_has_confirmation
flag. to let the object know it has a required confirmation page, which should get called after the validation is successfull, and before the action is handled on the back-end.
This function is used to set the
default CSS class used on form field text when there is no error on that field
This method is used to set the value for a non hidden element
This function is used to set the css class that is used on text when an error on that field is detected.
This allows us to change the form errors table title
This method allows you to override the width of the form errors table.
By default it uses the width of the form as its size.
**************************
This method is a helper method to set the FormElement's tabindex.
this method sets the form name
This method is used to set the value for a hidden element
This sets the readonly flag.
When this flag is set, all of the FormElements will be set to readonly.
This function is used to set the required field marker
This sets the required text
This sets the stripslashes flag for this object.
This is a 'hidden' version of pre_confirm to allow calling the form elements pre_confirm methods. This is needed for forms that have a confirmation requirement and has file inputs.
If the file input FormElement doesn't save off the uploaded file, then the confirmation page will not get the file. apache may nuke the temp file in /tmp.
This method is used to keep a local reference of the FormProcessor's FormValidation object
This method tests to see if we have an element named $label, so we can operate on it.
Documentation generated on Fri, 28 Jan 2011 08:53:06 -0500 by phpDocumentor 1.4.3