Append the current element's value to the tree
Here we are interested only in collecting the value of elements, but in subclasses we would probably want to collect more information about the element that we are visiting.
Parameters:
API Tags:
Redefined in descendants as:
string applyJavaScript(
SForm
$form
)
|
|
Applies the rendered JavaScript to the given form
This differs from rendJavaScript() in that this actually applies the JavaScript to the form. It sets the 'onsubmit' attribute of the form and returns an HTML/JavaScript string suitable to embed in your document.
Parameters:
|
object The |
$form: |
form to render the javascript to |
API Tags:
array fetch(
SForm
$form
)
|
|
We need to retrieve the resulting data
This is called after the render to retrieve any useful data from it. Here, the the rendered array is returned.
Parameters:
API Tags:
| Return: | Array of values |
| Access: | public |
Redefined in descendants as:
Move back down in the stack
Once we move up into some container and render some elements, we must exit from said container. This is called when exiting from a container.
The passed object is the container that we are exiting out of.
Parameters:
|
object Current |
$node: |
container. |
API Tags:
Redefined in descendants as:
Move up a level in the stack
This is called when entering a contianer. That includes the base form.
The object that is passed is the container that this renderer is moving through.
Parameters:
|
object Current |
$node: |
container. |
API Tags:
Redefined in descendants as:
void rendJavaScript(
string
$funcName
)
|
|
Render the array of JavaScript into a script
This returns a complete JavaScript function of the requested name. This function is in a format such that it could be placed in an external document, so the user's browser can cache it. Caching would be useful if this is a large document or the user uses this form often.
This is one of the accessory methods in the renderer, it does not need to be called depending on the renderer.
If you do decide to use it, this wraps the generated JavaScript (stored in $javascript) in a function that declares the needed variables and cleans up afterward. The JavaScript function expects one parameter: the form object in the web page which is being submitted.
The "clean up" JavaScript at the end serves two purposes:
If no error was found, all of the submit buttons have their values changed to "Loading..." and become disabled. Then the form CSS is altered so the mouse cursor displays the 'wait' icon.
If an error has been thrown, an error alert is constructed and displayed. Then the first element to trigger the error is focused on to draw
the user's attention to said element. All elements that are flagged also have their backgrounds yellowed.
Use the 'elmErrorColor' option to change the background color that elements are changed to. Use the 'newSubmitValue' option to disable or change how the submission buttons are changed. Use SForm_Element::setOption() to toggle these options.
Parameters:
|
string |
$funcName: |
Name of the generated function. |
API Tags:
void startForm(
SForm
$form
)
|
|
Start rendering the form
By default, we really don't care if we are starting the form because our intent is just to collect the values into an array.
Parameters:
|
object The |
$form: |
form we are rendering |
API Tags: