Kappa Computer Solutions, LLC

Leveraging UNIX, GNU/Linux, open source, and
custom software solutions for business and beyond

Phone: 877•367•8837   Twitter: kappacs

Home arrow Articles arrow FormRequest: Dynamic Form Parameters
FormRequest: Dynamic Form Parameters PDF Print E-mail
Article Index
FormRequest: Dynamic Form Parameters
Page 2
Page 3
 

FormRequest Details

If the first parameter is either a DOM form element or any element within the form that has a "form" property referencing the enclosing form, that form will be the recipient of the dynamically added hidden inputs. Otherwise, the first form on the page (document.forms[0]) is used.

Subsequent parameters should be objects whose attributes and values will be used to dynamically generate the hidden inputs. If the object is an array, the elements in the array are interpreted alternately as names and values instead.

If you need to pass multiple values for the same parameter, you can use an array of values or duplicate the key value (in an array object) as follows:

{ "name": [ "value1", "value2" ] }
[ "name", [ "value1", "value2" ] ]
[ "name", "value1", "name", "value2" ]

Special names "=action", "=enctype", "=method", and "=target" can be used to override the action URL, enctype (encoding type), method (GET or POST), or target window of the form for specific calls to formRequest.

If the target of the form is another window (either because of a target attribute in the original request or because of an "=target" setting in a formRequest), or if the form generates an AJAX request, the page will not be replaced and it is therefore possible for the form to be submitted multiple times as the result of additional user action. Subsequent calls to formRequest will undo the previous changes before processing the new formRequest. If you need to undo the changes in any other context, simply call "undoFormRequest()".

One final special name, "=confirm", prompts the user (using the value as the prompt) to confirm or cancel the form submission.

None of the special names or their values are passed in the request.



 
Next >