Structures_Form |
[ class tree: Structures_Form ] [ index: Structures_Form ] [ all elements ] |
Packages: Structures_Form Classes: Files:
Alpha.php
AlphaNumeric.php Base.php ElementInterface.php ElementSetInterface.php Exception.php Form.php GroupInterface.php LengthRange.php Numeric.php NumericRange.php Regex.php RendererInterface.php Required.php RuleInterface.php |
[ Top ] $registeredElements = array()[line 122] The registered element types.
[ Top ] $registeredRules = array()[line 130] The registered rules.
[ Top ] $renderedForm =[line 213] The rendered form.
[ Top ] $renderer =[line 205] The object responsible for displaying the form.
[ Top ] $requiredNote = ' denotes required field'[line 171] A note identifying the required field marker.The renderer should prepend the required symbol to the note.
[ Top ] $requiredSymbol = '*'[line 181] A symbol identifying the required fields.The renderer should provide some sort of formatting to make the symbol standout.
[ Top ] $rules = array()[line 114] The rules to be applied to each element.
[ Top ] $submitCallback =[line 138] The method to call after values are collected from a submitted form.
[ Top ] $submitObjects =[line 154] Send the widgets to the callback instead of the values.
[ Top ] Method Detail__construct (Constructor) [line 294]
Constructor. Sets the callbacks then registers any default element or rule types. A callback must be passed in so that the form knows what to do with the values that are collected by the form. Optionally, the user may tell the form to pass the widgets themselves, not the values, to the callback. The user may also define an error callback, which will be called if any rules are viloated. If no error callback is defined, the default callback ($this->defaultErrorCallback()) will be used. The default just passes the errors on to the renderer.
Parameters:
[ Top ]
addElement [line 523]
Creates and adds an element to the form. Only elements types that are registered with Structures_Form may be added to the form. This helps to ensure that the elements implement the proper interface. To avoid overhead, type registration is not checked until the type is added to the form. This method passes any extra arguments on to the element constructor. This allows one method to be used for creating many types of elements. The exact number and type of arguments that is passed to this method varies depending on the type of element to be created. If the wrong number or type of arguments is passed, the element constructor should throw an exception. An exception may be thrown by createElement or addElementObject. If so it will be bubble up through this method.
Parameters:
[ Top ]
addElementObject [line 739]
Adds an element to the form. Only elements types that are registered with Structures_Form may be added to the form. This helps to ensure that the elements implement the proper interface. To avoid overhead, type registration is not checked until the type is added to the form.
Parameters:
[ Top ]
addElementObjectToGroup [line 1210]
Adds an element object to a group. A group is just a way to logically and visually group form elements. Elements can be added to or removed from a group without removing them from the form all together. However, obviously if the element is removed from the form, it will be removed from the group. If you readd the same element object, it will NOT be readded to the group. This method returns true if the element has been added to the group and false in all other cases including when the element is not part of the form or the group does not exist. Elements may only be part of one group. If the element is already part of another group, it will not be added to this group. An element must be part of the form before it can be added to the group. This is normally not a problem as elements should be created using addElement or createElement.
Parameters:
[ Top ]
addElementToGroup [line 1131]
Adds an element to a group. A group is just a way to logically and visually group form elements. Elements can be added to or removed from a group without removing them from the form all together. However, obviously if the element is removed from the form, it will be removed from the group. If you readd the same element object, it will NOT be readded to the group. Elements may only be part of one group. If the element is already part of another group, it will not be added to this group.
Parameters:
[ Top ]
addRule [line 1705]
Associates a rule with a form element. When a form is submitted, the values will be checked against any rules that have been associated with the elements. A rule of a give type can only be added to an individual element once. Attempting to add a rule to the same element twice will have no extra effect. This method passes any extra arguments on to the rule constructor. This allows one method to be used for creating many types of rules. The exact number and type of arguments that is passed to this method varies depending on the type of rule to be created. If the wrong number or type of arguments is passed, the rule constructor should throw an exception.
Parameters:
[ Top ]
addRuleToObject [line 1879]
Associates a rule with a form element object. When a form is submitted, the values will be checked against any rules that have been associated with the elements. A rule of a give type can only be added to an individual element once. Attempting to add a rule to the same element twice will have no extra effect. This method passes any extra arguments on to the rule constructor. This allows one method to be used for creating many types of rules. The exact number and type of arguments that is passed to this method varies depending on the type of rule to be created. If the wrong number or type of arguments is passed, the rule constructor should throw an exception.
Parameters:
[ Top ]
clearValues [line 1417]
Clears the values of all form elements (if possible).
[ Top ]
createElement [line 658]
Creates an element but does not add it to the form. Only elements types that are registered with Structures_Form may be added to the form. This helps to ensure that the elements implement the proper interface. To avoid overhead, type registration is not checked until the type is added to the form. This method passes any extra arguments on to the element constructor. This allows one method to be used for creating many types of elements. The exact number and type of arguments that is passed to this method varies depending on the type of element to be created. If the wrong number or type of arguments is passed, the element constructor should throw an exception.
Parameters:
[ Top ]
createRule [line 1760]
Creates a rule object. When a form is submitted, the values will be checked against any rules that have been associated with the elements. A rule of a give type can only be added to an individual element once. Attempting to add a rule to the same element twice will have no extra effect. This method passes any extra arguments on to the rule constructor. This allows one method to be used for creating many types of rules. The exact number and type of arguments that is passed to this method varies depending on the type of rule to be created. If the wrong number or type of arguments is passed, the rule constructor should throw an exception.
Parameters:
[ Top ]
defaultErrorCallback [line 1529]
Simply passes the error array on to the renderer. It might be a good idea to re-render the form after errors are added but that is the responsibility of the developer and the renderer. It cannot be determined here if the user wants to re-render. Nor can the form reliably be changed form here. If errors need to be handled in a different way, you should set a custom error callback either when the form is constructed or by using setErrorCallback().
Parameters:
[ Top ]
disbandGroup [line 1016]
Disbands a group. This method disbands a group. It does not destroy the elements in the group or even remove them from the form. It simply disbands the group and makes the elements free floating individuals. The elements are inserted where the group used to be. This method returns an array containing the names of any elements that were in the group before it was disbanded. If the group does not exist, this method will return an empty array.
Parameters:
[ Top ]
elementExists [line 957]
Returns whether or not the given element is associated with this form.
Parameters:
[ Top ]
elementObjectExists [line 971]
Returns whether or not the element object is associated with this form.
Parameters:
[ Top ]
getAllElements [line 945]
Returns an array of all elements.
[ Top ]
getDefaultRenderer [line 2094]
Creates a default renderer object. This method may be called by group elements that need to renderer elements but do not have a renderer set.
[ Top ]
getDefaults [line 1472]getElement [line 923]
Returns the form element with the given name.
Parameters:
[ Top ]
getElementsByType [line 903]
Returns all of the elements in the form of the given type.
Parameters:
[ Top ]
getErrorCallback [line 352]
Returns the error callback.
[ Top ]
getErrorMessage [line 489]
Returns an error message for the given error code.
Parameters:
[ Top ]
getGroup [line 1086]
Returns the group element. If the group does not exists, this method returns false.
Parameters:
[ Top ]
getGroupElements [line 1280]
Returns an array containing the names of the elements in the given group. If the group does not exist, this method returns an empty array.
Parameters:
[ Top ]
getGroups [line 1101]getPosition [line 991]
Returns the current position of the element.
Parameters:
[ Top ]
getRenderedForm [line 2188]
Returns the most recently rendered widget. This method will not render the form! It only returns the widget created when render() was called!
[ Top ]
getRequiredNote [line 1978]getRequiredSymbol [line 2001]getSubmitCallback [line 341]
Returns the submit callback.
[ Top ]
getValue [line 1330]
Returns the current value for the given element.
Parameters:
[ Top ]
getValues [line 1304]
Returns the current value for all elements in an associative array. The array will be of the form: array(<name> => <value>);
[ Top ]
groupExists [line 1051]
Returns whether or not the given group exists in this form.
Parameters:
[ Top ]
insertElement [line 555]
Inserts an element object at the given location. Only elements types that are registered with Structures_Form may be added to the form. This helps to ensure that the elements implement the proper interface. To avoid overhead, type registration is not checked until the type is added to the form.
Parameters:
[ Top ]
isElementRegistered [line 874]
Returns whether or not an element type is registered.
Parameters:
[ Top ]
isGroup [line 1071]
Returns whether or not the element is a group.
Parameters:
[ Top ]
isIncludable [line 819]
Returns whether or not a path is in the include path.
Parameters:
[ Top ]
isRequired [line 2013]
Returns whether or not an element is required.
Parameters:
[ Top ]
isRuleApplied [line 1941]
Returns whether or not the give rule is currently associated with any form elements.
Parameters:
[ Top ]
isRuleAppliedToElement [line 2031]
Returns whether or not the given rule is applied to the given element. This method returns true if the rule is applied to the element and false in all other cases including if the rule or element is not defined.
Parameters:
[ Top ]
isRuleRegistered [line 1664]
Returns whether or not a rule is registered.
Parameters:
[ Top ]
moveElement [line 626]
Moves an element object from its current position to the given position. If the position is greater than the number of elements, the element will be added to the end of the form.
Parameters:
[ Top ]
registerDefaultRules [line 441]
Registers the default rule types. Rule objects are used to validate the values of the form elements before they are submitted to the callback. If an elements value violates a rule a rule callback will be called which allows the user to handle errors in their own way. All violations are collected on each submit and then passed off to the rule callback. Only registered rules may be applied to a form element. All registered rules must implement the Structures_Form_RuleInterface. To avoid overhead, a rule is not checked until it is applied to a form element.
[ Top ]
registerElement [line 785]
Registers an element type with this form. Before an element type can be used in a form, it must be registered. Registering an element type helps to make sure that type names are unique and that element classes implement the needed interface. To avoid overhead, registered classes are not checked until the type is instantiated.
Parameters:
[ Top ]
registerElementSet [line 377]
Registers a set of elements. Only elements types that are registered with Structures_Form may be added to the form. This helps to ensure that the elements implement the proper interface. Element sets must also define a default renderer. To avoid overhead, type registration is not checked until the type is added to the form. registerElement may throw an exception that will be passed along to the calling code.
Parameters:
[ Top ]
registerRule [line 1594]
Registers a rule class with the form. Rule objects are used to validate the values of the form elements before they are submitted to the callback. If an elements value violates a rule a rule callback will be called which allows the user to handle errors in their own way. All violations are collected on each submit and then passed off to the rule callback. Only registered rules may be applied to a form element. All registered rules must implement the Structures_Form_RuleInterface. To avoid overhead, a rule is not checked until it is applied to a form element.
Parameters:
[ Top ]
removeElement [line 718]
Removes an element from the form by name.
Parameters:
[ Top ]
removeElementFromGroup [line 1164]
Removes an element from a group. A group is just a way to logically and visually group form elements. Elements can be added to or removed from a group without removing them from the form all together. However, obviously if the element is removed from the form, it will be removed from the group. If you readd the same element object, it will NOT be readded to the group.
Parameters:
[ Top ]
removeElementObject [line 755]
Removes an element object from the form. This method is useful if an element has been added with the wrong name. Trying to remove it by the name returned by getName() will not work so you must remove it by the object.
Parameters:
[ Top ]
removeElementObjectFromGroup [line 1249]
Removes an element object from a group. A group is just a way to logically and visually group form elements. Elements can be added to or removed from a group without removing them from the form all together. However, obviously if the element is removed from the form, it will be removed from the group. If you readd the same element object, it will NOT be readded to the group. This method returns true if the element has been removed from the group and false in all other cases including when the element is not part of the form or the group does not exist.
Parameters:
[ Top ]
removeRule [line 1836]
Removes a rule from an element. When a form is submitted, the values will be checked against any rules that have been associated with the elements. A rule of a give type can only be added to an individual element once. Attempting to add a rule to the same element twice will have no extra effect. Therefore, it only makes sense to try to remove a rule once. This method will return true if the rule is not associated with the element. This means that it will also return true even if the rule was never associated with the element in the first place.
Parameters:
[ Top ]
removeRuleFromObject [line 1917]
Removes a rule from a form element object. When a form is submitted, the values will be checked against any rules that have been associated with the elements. A rule of a give type can only be added to an individual element once. Attempting to add a rule to the same element twice will have no extra effect. Therefore, it only makes sense to try to remove a rule once. This method will return true if the rule is not associated with the element. This means that it will also return true even if the rule was never associated with the element in the first place.
Parameters:
[ Top ]
render [line 2139]
Returns a container widget holding the form elements. Passes the elements, required note and required symbol to the renderer and then calls renderer(). Pulling elements out of a renderer is a pain in the ass. Trying to find the correct widget (or parent widget) can be nearly impossible. Therefore, even if you remove a widget from the form, it will still appear if the widget was removed after the form was rendered.
[ Top ]
restoreDefaults [line 1461]
Restores the elements to their default values. This method over writes any values currently set! If no defaults were set, this method will return an empty array.
[ Top ]
ruleExists [line 1955]
Returns whether or not a rule with the given name already exists.
Parameters:
[ Top ]
setDefaultRenderer [line 2115]
Creates a default renderer and sets it as the current renderer. An exception may be thrown by setRenderer. It will pass through to the calling function.
[ Top ]
setDefaults [line 1441]
Sets the values of the elements and make the given values the defautls. This method over writes any values currently set!
Parameters:
[ Top ]
setErrorCallback [line 330]
Sets the error callback.
Parameters:
[ Top ]
setRenderer [line 2064]
Sets a renderer object. Renderers must implement Structures_Form_RendererInterface. This helps to ensure consistency among the API and avoid any fatal errors. A renderer is used to position and display the form elements within a container widget. Unlike rules and elements, renderers are created on their own (not through a form method). This is because they do not need to know thing about the form at construction time and the form does not need to know anything about the renderer until the form is to be displayed. A form may only have one renderer at a time. Setting a second renderer will overwrite the first. If no renderer is set, the default renderer will be used.
Parameters:
[ Top ]
setRequiredNote [line 1967]
Sets the require note.
Parameters:
[ Top ]
setRequiredSymbol [line 1990]
Sets the require symbol.
Parameters:
[ Top ]
setValue [line 1392]
Sets the value for the given element. This method returns true if the value appears to have been changed. If false is returned, it may indicated that the element does not exist, that the new value was the same as the old value, or that it was frozen.
Parameters:
[ Top ]
setValues [line 1361]
Sets the values for the form elements. The array passed in should be of the form: array(<name> => <value>)
Parameters:
[ Top ]
submit [line 1483]
Collects submitted values and calls the callback or error callback.
[ Top ]
swapElementSet [line 2206]
Changes the UI of the form from the current set of elements to the given element set. This method allows you to quickly and easily change from one element set to another. In most cases it is only necessary to change renderers but some renderers may have additional requirements for the elements that necessitate changing the classes that represent the elements.
Parameters:
[ Top ]
unRegisterElement [line 850]
Unregisters an element type with a form. An element type may not be unregistered if the form contains elements of the given type. You may want to unregister a type to prevent a certain type from being used in the form. For example if your app creates forms on the fly from user supplied data, you can unregister the text type to prevent users from creating a form with free form text entries.
Parameters:
[ Top ]
unRegisterRule [line 1640]
Unregisters a rule with the form. Only registered rules may be applied to a form element. A rule may not be unregistered if it is currently being applied to one or more form elements. You may want to unregister a rule to prevent it from being applied to a form. For example, if your app creates forms on the fly, you may want to unregister a rule to prevent the user from applying a rule that their PHP installation cannot support (regular expressions may not be available).
Parameters:
[ Top ]
validate [line 1549]
Validates the values of the form against the applied rules. This method returns an array even if there are no errors. If the array is empty, then no errors occurred or no rules were applied.
[ Top ]
Documentation generated on Mon, 11 Mar 2019 14:44:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004. |