Framework
3.9
|
CompositeAutoForm is a container for situations where multiple AutoForms need to be managed on the same page within a single outer form. More...
Public Member Functions | |
CompositeAutoForm ($method="POST", $action="", $containerClass="") | |
Creates a new CompositeAutoForm. More... | |
addForm ($form, $enableValidation=false) | |
Add a sub-form to this form. More... | |
writeScript () | |
Write script for all the sub-forms. More... | |
preset () | |
Array of fields to be ignored when determining if a record is empty in cases where empty records should not trigger an error. More... | |
drawForm () | |
Draw the sub-forms, with a combined single set of submission buttons. More... | |
drawReadOnly () | |
Draw the read-only sub-forms. More... | |
button ($text, $url, $confirm=null, $isScript=false) | |
Adds a custom button to the form. More... | |
drawButtons () | |
Draws any additional buttons specified in the calling script. More... | |
save () | |
Public Attributes | |
$forms | |
$buttons = array() | |
$method | |
$action | |
$containerClass | |
$buttonAlignment = "left" | |
$preset = array() | |
$readOnlyForm | |
Specifies whether the entire form is read-only. More... | |
$onSaveComplete = null | |
Callback event handler that is fired after all the subordinate AutoForms have finished saving data to the database. More... | |
CompositeAutoForm is a container for situations where multiple AutoForms need to be managed on the same page within a single outer form.
To create a composite form, create an instance of CompositeAutoForm and add to it all the subforms (instances of SubordinateAutoForm) to appear on that page. Some subforms may need special handling and so you will need to create a child class of SubordinateAutoForm.
Example: $compositeForm = new CompositeAutoForm("POST", "", "my_form_id");
$compositeForm = new CompositeAutoForm("POST", "", "parts_order_address_form"); $shippingPanel = new OrderAddressForm($compositeForm, "shipping", "Shipping Address", $shippingAddress, "ship_address_id", $orderShip); $billingPanel = new OrderAddressForm($compositeForm, "billing", "Billing Address", $billingAddress, "bill_address_id", $order);
Where OrderAddressForm is a child of class SubordinateAutoForm.
Definition at line 29 of file composite_auto_form.inc.
CompositeAutoForm::addForm | ( | $form, | |
$enableValidation = false |
|||
) |
Add a sub-form to this form.
AutoForm | $form | the form to be added |
Definition at line 67 of file composite_auto_form.inc.
CompositeAutoForm::button | ( | $text, | |
$url, | |||
$confirm = null , |
|||
$isScript = false |
|||
) |
Adds a custom button to the form.
string | $text | the button label text |
string | $url | the URL to handle the button press |
string | $confirm | optional confirmation message |
boolean | $isScript | true if the url is javascript code to execute, false if it is a URL to redirect to |
Definition at line 209 of file composite_auto_form.inc.
CompositeAutoForm::CompositeAutoForm | ( | $method = "POST" , |
|
$action = "" , |
|||
$containerClass = "" |
|||
) |
Creates a new CompositeAutoForm.
string | $method | the HTTP method to use |
string | $action | the URL to submit to |
string | $containerClass | CSS class to use for the container for each sub-form |
Definition at line 48 of file composite_auto_form.inc.
CompositeAutoForm::drawButtons | ( | ) |
Draws any additional buttons specified in the calling script.
Definition at line 218 of file composite_auto_form.inc.
CompositeAutoForm::drawForm | ( | ) |
Draw the sub-forms, with a combined single set of submission buttons.
Reimplemented in SpreadsheetForm.
Definition at line 137 of file composite_auto_form.inc.
CompositeAutoForm::drawReadOnly | ( | ) |
Draw the read-only sub-forms.
Definition at line 176 of file composite_auto_form.inc.
CompositeAutoForm::preset | ( | ) |
Array of fields to be ignored when determining if a record is empty in cases where empty records should not trigger an error.
For example: A spreadsheet form has the fields "sort_order" preset. The user does not complete any values in a row. If the subordinate form has allowEmpty set to true, we don't want the value in the sort_order field to trigger an error message.
Definition at line 126 of file composite_auto_form.inc.
CompositeAutoForm::save | ( | ) |
CompositeAutoForm::writeScript | ( | ) |
Write script for all the sub-forms.
Reimplemented in SpreadsheetForm.
Definition at line 77 of file composite_auto_form.inc.
CompositeAutoForm::$action |
Definition at line 34 of file composite_auto_form.inc.
CompositeAutoForm::$buttonAlignment = "left" |
Definition at line 36 of file composite_auto_form.inc.
CompositeAutoForm::$buttons = array() |
Definition at line 32 of file composite_auto_form.inc.
CompositeAutoForm::$containerClass |
Definition at line 35 of file composite_auto_form.inc.
CompositeAutoForm::$forms |
Definition at line 31 of file composite_auto_form.inc.
CompositeAutoForm::$method |
Definition at line 33 of file composite_auto_form.inc.
CompositeAutoForm::$onSaveComplete = null |
Callback event handler that is fired after all the subordinate AutoForms have finished saving data to the database.
Definition at line 39 of file composite_auto_form.inc.
CompositeAutoForm::$preset = array() |
Definition at line 37 of file composite_auto_form.inc.
CompositeAutoForm::$readOnlyForm |
Specifies whether the entire form is read-only.
Definition at line 38 of file composite_auto_form.inc.