Framework
3.9
|
SearchForm generates forms for searching based on a supplied DataItem. More...
Public Member Functions | |
SearchForm ($target, $method="POST", $action="", $id="") | |
Create a new Search Form. More... | |
setMatchingMode ($mode) | |
Sets the matching mode for the specified fields. More... | |
getMatchingMode ($field) | |
Retrieve the matching mode that was set for the specified field. More... | |
populateFromGET () | |
Populate the search parameters from an HTTP GET request. More... | |
populateFromPOST () | |
Populate the search parameters from an HTTP POST request. More... | |
populateFromREQUEST () | |
setHandler ($field, $handler) | |
Override an existing SearchParameter constraint clause handler or add one. More... | |
writeScript () | |
Generate any javascript required by the search form. More... | |
addDefaultValidators () | |
Creates default validators for fields in the form. More... | |
setSearchValidator ($renderer, $field, $mode) | |
After AutoForm configures the validators, modify the field name to include the mode with which the tag will drawn in the form. More... | |
drawForm () | |
Write out the HTML for the search form. More... | |
renderSearchFields () | |
renderOneSearchField ($field) | |
renderAdditionalFields ($obj) | |
drawReadOnly () | |
Draws the form in read-only mode. More... | |
Public Member Functions inherited from AutoForm | |
AutoForm ($target, $method="POST", $action="", $id="") | |
Creates a new AutoForm, based on the supplied target DataItem. More... | |
getData () | |
Returns the target data item for the form. More... | |
setDataSet ($params) | |
setLayout ($layout) | |
Override the default layout manager. More... | |
setFieldOrder () | |
Override the display order for ungrouped field. More... | |
createRenderer ($field) | |
This factory method creates a FieldRender based on the type of the specified field. More... | |
getValidationEngine () | |
Retrieve the validation engine for this AutoForm. More... | |
makeSubordinate () | |
Set this AutoForm to be a subordinate form within a CompositeAutoForm. More... | |
configureValidators () | |
getRenderer ($field) | |
Retrieves the FieldRenderer object for the specified field. More... | |
override ($field, $label="", $renderer=null) | |
Overrides the defaults for the specifed form field, providing a new label and/or FieldRenderer. More... | |
overrideType ($field, $type, $label="") | |
Override the default type for the specified form field, providing a FieldRenderer based on the supplied type (and optionally also override the field label) More... | |
add ($renderer, $field="", $label="") | |
Adds an additional (pseudo) field to the form. More... | |
hide () | |
Call this method to hide one or more fields in the form's user interface. More... | |
hideExcept () | |
Call this method to hide all the fields in the form's user interface EXCEPT the fields specified. More... | |
isHidden ($field) | |
Check whether the specified field is hidden in the form. More... | |
annotate ($field, $text) | |
Adds an annotation (such as brief explanatory text) to the specified field. More... | |
alias () | |
Use this method to override the display name for fields in the form. More... | |
related ($class, $constraint="", $format=null, $field=null, $label=null, $allowAdd=false, $allowNone=true) | |
Utility function to add a RelatedItemSelectFieldRender. More... | |
crossReference ($xrefClass, $options, $format, $field, $label=null, $xrefField=null) | |
Utility function to add a CrossReferenceSelectFieldRenderer. More... | |
dropdown ($field, $label="", $options=null, $onchange=null, $grouped=false) | |
Utility function to add a SelectFieldRenderer. More... | |
groupedDropdown ($field, $label, $options, $onchange=null) | |
Utility function to add a SelectFieldRenderer with grouped options. More... | |
radio ($field, $label, $options, $onchange=null) | |
Utility function to add a RadioButtonFieldRenderer. More... | |
checklist ($field, $label, $options, $grouped=false) | |
Utility function to add a CheckListFieldRenderer. More... | |
toggle ($field, $label="", $ragged=false) | |
Utility function to create a ToggleFieldRenderer. More... | |
group ($name) | |
Define a field grouping. More... | |
addToGroup ($name) | |
Add more fields to the specified group. More... | |
groupDescription ($name, $description, $position='start') | |
Add a description block to a group. More... | |
getGroupDescription ($name, $position='start') | |
Retrieves the group description for the specified group. More... | |
makeGroupCollapsible ($name, $toggleControl) | |
Allows a group to be shown or hidden based on the value of another control. More... | |
setGroupCSSClass ($name, $cssClass) | |
Sets a specific CSS class on the specified CSS group. More... | |
getGroupCSSClass ($name) | |
Gets the CSS class for the specified group, if one has been set. More... | |
removeGroup ($name) | |
Remove the specified field grouping from the form. More... | |
hideLabel () | |
Use this method to hide the labels for the specified fields in the form. More... | |
readonly () | |
Call this method to make one or more fields read-only in the form's user interface. More... | |
isReadOnly ($field) | |
Determine whether the specified field is being displayed read-only. More... | |
required () | |
Call this method to mark one or more fields as being required fields. More... | |
hasAdditional ($field) | |
Check if this field exists as an additional field. More... | |
isRequired ($field) | |
Determine whether the specified field is a required field for the form. More... | |
requiredIfChecked ($field, $checkbox, $fieldTitle="", $checkboxTitle="", $message="") | |
Make a field required if a given checkbox is checked. More... | |
requiredSubSelect ($field, $fieldTitle, $subFieldTitle="", $message="") | |
Make a subselect field required. More... | |
regexp ($field, $expr, $message) | |
Validate the user input for the specified field against a regular expression, outputting the supplied message if the entered value does not match. More... | |
dateRange ($field, $min="", $max="", $message=null) | |
unique () | |
Adds a uniqueness validator to the specified field(s). More... | |
uniqueWithConstraint ($field, $message, $constraint="") | |
range ($field, $min, $max, $message=null) | |
Adds a range validator to the specified field. More... | |
match ($field, $title, $match, $matchTitle, $caseSensitive=true) | |
Specifies that two field values must match (as in a password/confirmation pair, for instance). More... | |
password ($field, $title) | |
Adds a password validator to the specified field. More... | |
disableAutoComplete () | |
Disable autocomplete for the selected fields. More... | |
button ($text, $url, $confirm=null, $isScript=false, $cssClass=null) | |
Adds a custom button to the form. More... | |
ajaxSubmit ($success, $failure=null) | |
Put the form into AJAX submission mode. More... | |
partialSaveButton ($containerID, $label="Save") | |
Activate partial saves for this form. More... | |
matchesSubmitted () | |
Determine if this form is the one that was submitted. More... | |
drawSubmitButtons ($obj, $pk, $submitLabel) | |
renderAllFields ($obj) | |
renderFields ($obj) | |
renderOneField ($field, $renderScript=false) | |
drawButtons () | |
Draws any additional buttons specified in the calling script. More... | |
prettifyFieldName ($field) | |
Generates a human-readable label from the given field name. More... | |
load ($id) | |
Loads the underlying DataItem from the database, using the specified primary key value. More... | |
save () | |
Saves the posted values to the database. More... | |
handlePartialSave ($success) | |
preProcessFields ($pk, $filter) | |
postProcessFields ($pk, $filter) | |
remove (&$obj) | |
validate () | |
Validate the posted values for the form. More... | |
patchUpReferences () | |
Public Attributes | |
$modifiers | |
$params | |
$hasSearchCriteria = false | |
$emptyMessage = "No search criteria was provided." | |
$preserveQueryString = false | |
$searchModeTypes | |
Public Attributes inherited from AutoForm | |
$formCSS = "" | |
CSS Class to use for the table containing the form. More... | |
$labelCSS = "" | |
CSS Class to use for label cells. More... | |
$valueCSS = "" | |
CSS Class to use for field/value cells. More... | |
$buttonCSS = "" | |
CSS Class to use for buttons. More... | |
$buttonLineCSS = "submit" | |
CSS Class to use for the button line (container for form buttons) More... | |
$inputCSS = "" | |
CSS Class to use for input fields. More... | |
$checkboxCSS = "" | |
CSS Class to use for checkbox fields. More... | |
$style = "" | |
$componentPath ="/fakoli" | |
$buttonAlignment = "left" | |
Default Form button alignment. More... | |
$passwordEncryptor = "" | |
Password Encryption method name. More... | |
$hideButtons = false | |
Set to true to hide form submission button line(s) More... | |
$capitalizationMode = "word" | |
Capitalization to be used for labels. Can be 'lower', 'upper', 'first' or 'word'. More... | |
$submitLabel = "" | |
Text to display on the form's submit button. If not specified defaut text will be generated based on the target DataItem. More... | |
$allowDelete = false | |
If true, the form will display a delete button if editing an existing item. More... | |
$deleteLabel = "" | |
Text to display on the form's delete button. If not specified defaut text will be generated based on the target DataItem. More... | |
$deleteMessage = "" | |
Confirmation message to display when the form's delete button is pressed. If not specified defaut text will be generated based on the target DataItem. More... | |
$method = "POST" | |
HTTP method that will be used to submit the form. More... | |
$action = "" | |
Action URL for submitting the form. Generally this can be left blank to submit back to the same page. More... | |
$renderers = array() | |
The field renderers collection. More... | |
$overrides = array() | |
The field overrides collection. More... | |
$hidden = array() | |
The hidden fields collection. More... | |
$additional = array() | |
The additional (pseudo) fields collection. More... | |
$additional_at_top = false | |
whether additional fields are rendered above the datamodel's field list; if false, then rendered below More... | |
$readonly = array() | |
The read-only fields collection. More... | |
$annotations = array() | |
The field annotations collection. More... | |
$buttons = array() | |
The custom buttons collection. More... | |
$fieldOrder = array() | |
The order in which to display ungrouped fields. More... | |
$validator | |
The ValidationEngine for this form. More... | |
$useLinkSubmit = false | |
Flag to indicate whether the submit button for the form should be rendered as a link (not common). More... | |
$HTMLEditorHideStyleBar = false | |
Flag to indicate that Rich Text Editors should be displayed with or without the style editing toolbar. More... | |
$HTMLEditorDefaultWidth = "540px" | |
Default width for Rich Text Editor controls. More... | |
$HTMLEditorDefaultHeight = "200px" | |
Default height for Rich Text Editor controls. More... | |
$passwordEnterLabel = "Enter" | |
Text for Password Enter label. More... | |
$passwordConfirmLabel = "Confirm" | |
Text for Password Confirm label. More... | |
$onDrawStart = null | |
Callback event handler that is fired just prior to drawing the form. More... | |
$onDrawComplete = null | |
Callback event handler that is fired just after the form been drawn. More... | |
$onInsertPreProcess = null | |
Callback event handler that is fired after fields have been preprocessed, but before the data has been saved to the database as a new record. More... | |
$onSavePreProcess = null | |
Callback event handler that is fired after fields have been preprocessed, but before the data has been saved to the database. More... | |
$onSaveComplete = null | |
Callback event handler that is fired after the AutoForm has finished saving data to the database. More... | |
$confirmPrompt = null | |
Specify a confirmation message. This will be shown to the user to have them confirm the form submission after the submit button is pressed. More... | |
$onDelete = "" | |
delete method name More... | |
$customSaveHandler = null | |
Use this field to override the default save behavior of your form. More... | |
$markRequiredFields = false | |
Set to true to add an asterisk after required field labels. More... | |
$onFormatLabel = null | |
Label Processing hook. More... | |
$buttons_at_top = false | |
$ajaxSubmitHandler = false | |
JavaScript Callback for AJAX Submit mode - called on success. More... | |
$ajaxFailureHandler = false | |
JavaScript Callback for AJAX Submit mode - called on failure. More... | |
$onSubmitHandler = null | |
Javascript Callback for user-defined onsubmit hook. More... | |
$required = array() | |
List of required fields. More... | |
$requiredFieldsText = "* indicates required field" | |
Text prompt to display when a form contains required fields. More... | |
$interstitialMessage = null | |
Specifies the message to display in an interstitial while the form is being submitted. More... | |
$interstitialSpinner = '/fakoli/images/loader.gif' | |
Set this property to override the default interstitial spinner animation. More... | |
$fields | |
Local field cache. More... | |
$groups = array() | |
List of field groups. More... | |
$collapsibleGroups = array() | |
List of collapsible groups and their default states. More... | |
$groupDescriptions = array() | |
List of group descriptions. More... | |
$groupDescriptionCSS = "group_description" | |
CSS class for group description blocks. More... | |
$groupCSSClasses = array() | |
Additional classes for specific groups. More... | |
$readOnlyForm | |
Specifies whether the entire form is read-only. More... | |
$subordinate | |
Specifies whether this form is a subordinate member of a composite form. More... | |
$hideEmptyFields = false | |
Specifies whether to hide empty fields when displaying a read-only form. More... | |
$showAnnotations = true | |
Set to false to hide field annotations. More... | |
$layout | |
Layout handler object. More... | |
$default_layout = "table" | |
$allowPartialSave = false | |
Whether to allow partial (i.e. in-progress) saves via AJAX. More... | |
$partialSaveContainerID | |
DOM ID for the element that will contain the partial save button. More... | |
$partialSaveLabel = "Save" | |
Label text for the partial save button. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from AutoForm | |
static | registerFieldRendererClass ($type, $rendererClass) |
Registers a custom type-to-renderer mapping. More... | |
Static Public Attributes inherited from AutoForm | |
static | $fieldRendererMap |
Provides the mapping from Type identifier to FieldRenderer. More... | |
SearchForm generates forms for searching based on a supplied DataItem.
Since SearchForm extends AutoForm, functionality such as alias, hide, layout and field grouping, and custom field renderer are available.
Example to create the search form:
$order = new Order(); $order->filter = new InclusionFilter("order_date", "first_name, "last_name);
// on submit, system redirects to "review_orders" identifier and retrives // values through GET $form = new SearchForm($order, "GET", "review_orders");
// default matching mode is equal but can be set to others available // in the SearchParameters $form->setMatchingMode("startsWith", "first_name", "last_name"); $form->setMatchingMode("range", "order_date");
$script .= $form->writeScript(); $form->drawForm();
Example of the page that processes the constraint:
$order = new Order(); $order->filter = new InclusionFilter("order_date", "first_name, "last_name);
// on submit, system redirects to "review_orders" identifier and retrives // values through GET $search = new SearchParameters($order); $search->fromGET();
$constraint = $search->generateConstraint();
Example of drawing a readonly SearchForm on the results page to show the user the criteria on which they searched.
$order = new Order(); $order->filter = new InclusionFilter("order_date", "first_name, "last_name); $form = new SearchForm($order, "GET", "review_orders"); $form->readOnlyForm = true; $form->button("Search Again", "order_search_form");
$script .= $form->writeScript(); $form->drawForm();
Definition at line 1073 of file search_form.inc.
SearchForm::addDefaultValidators | ( | ) |
Creates default validators for fields in the form.
Currently this adds Date format validators to all date fields - other fields are not affected.
This method is called automatically before the form is rendered.
Reimplemented from AutoForm.
Definition at line 1267 of file search_form.inc.
SearchForm::drawForm | ( | ) |
Write out the HTML for the search form.
Reimplemented from AutoForm.
Reimplemented in FilterForm.
Definition at line 1330 of file search_form.inc.
SearchForm::drawReadOnly | ( | ) |
Draws the form in read-only mode.
Used to display the search criteria on the results screen.
Reimplemented from AutoForm.
Definition at line 1555 of file search_form.inc.
SearchForm::getMatchingMode | ( | $field | ) |
Retrieve the matching mode that was set for the specified field.
string | $field | the field to query |
Definition at line 1121 of file search_form.inc.
SearchForm::populateFromGET | ( | ) |
Populate the search parameters from an HTTP GET request.
Definition at line 1130 of file search_form.inc.
SearchForm::populateFromPOST | ( | ) |
Populate the search parameters from an HTTP POST request.
Definition at line 1138 of file search_form.inc.
SearchForm::populateFromREQUEST | ( | ) |
Definition at line 1143 of file search_form.inc.
SearchForm::renderAdditionalFields | ( | $obj | ) |
SearchForm::renderOneSearchField | ( | $field | ) |
Definition at line 1482 of file search_form.inc.
SearchForm::renderSearchFields | ( | ) |
Reimplemented in FilterForm.
Definition at line 1415 of file search_form.inc.
SearchForm::SearchForm | ( | $target, | |
$method = "POST" , |
|||
$action = "" , |
|||
$id = "" |
|||
) |
Create a new Search Form.
DataItem | $target | the target DataItem object |
string | $method | (optional) the HTTP method to use for submitting the search request |
string | $action | (optional) the URL of the recipient script for the search request |
string | $id | (optional) the DOM ID for the generated search form |
Definition at line 1092 of file search_form.inc.
SearchForm::setHandler | ( | $field, | |
$handler | |||
) |
Override an existing SearchParameter constraint clause handler or add one.
$field | string name of the field |
$handler | callable callback function that creates the constraint clause for the given field |
Reimplemented in FilterForm.
Definition at line 1156 of file search_form.inc.
SearchForm::setMatchingMode | ( | $mode | ) |
Sets the matching mode for the specified fields.
string | $mode | the matching mode, which can be one of "equal", "like", "startsWith", "from" or "to" |
Definition at line 1106 of file search_form.inc.
SearchForm::setSearchValidator | ( | $renderer, | |
$field, | |||
$mode | |||
) |
After AutoForm configures the validators, modify the field name to include the mode with which the tag will drawn in the form.
For date range, the mode is "from" and an additional validator needs to be created for the "to" field.
obj | $renderer | - field renderer |
String | $field | - field name |
String | $mode | - matching mode |
Definition at line 1306 of file search_form.inc.
SearchForm::writeScript | ( | ) |
Generate any javascript required by the search form.
Reimplemented from AutoForm.
Reimplemented in FilterForm.
Definition at line 1165 of file search_form.inc.
SearchForm::$emptyMessage = "No search criteria was provided." |
Definition at line 1078 of file search_form.inc.
SearchForm::$hasSearchCriteria = false |
Definition at line 1077 of file search_form.inc.
SearchForm::$modifiers |
Definition at line 1075 of file search_form.inc.
SearchForm::$params |
Definition at line 1076 of file search_form.inc.
SearchForm::$preserveQueryString = false |
Definition at line 1079 of file search_form.inc.
SearchForm::$searchModeTypes |
Definition at line 1081 of file search_form.inc.