Parses an object and pulls form variables from the request buffer by matching the property names to the request variables.

In v7.0 and later, this function replaces the .aFormVars() method of older versions.

Optionally you can pass in a prefix for form variables to allow for potential naming problems for properties of multiple objects.

Ideally you pass in existing object and Web Connection will populate the properties of the object from the form variables doing type conversions to match the type of the property assigned to.

If you don't pass an object a generic object is created for you with properties for each of the form variables of the HTML form and populated with String values only.

This method can be extremely useful for reducing form variable retrieval code from your Web applications especially if you map form fields directly to objects. Form variables must match the property names either directly or with an optional prefix (such as txt, but the prefix must consistent for all variables). You can call this function multiple times with different prefixes to map multiple objects.


Return Value

nothing. Object passed in as parameter is filled with values.


An existing object to be imported to. Code walks the object structure (1 dimensionally) by looking for form vars.

If you don't pass an object

Optional - Prefix that can be used in form variables. This prefix is stripped when matching property values.

You can use this for prefixes like "txt" or "chk", or for entire child objects like "customer.address." to capture the properties of the address object.

Optional - Comma delimited list of properties that aren't updated.


Logical values are handled from checkboxes, but non-logical checkbox values will not be captured when not checked. Selection values for checkboxes must be On or True in order to be recognized as a True value for a logical. Multiselect lists or multiple selection radios will pull only the first selection into the target property.

Object and array members are ignored and not filled or updated. Date values are imported with CTOD and CTOT. There may be formatting problems so these properties may require post processing and potential problems with SET STRICTDATE settings.

You can work around any misparsing problems by performing additional post processing on the captured object data or handling any fields that might have been missed manually.

This method can cause issues with logical values that are not on the form. There's no safe way to detect checked status as checkboxes and radio buttons do not send unchecked values as form variables so it's possible that non-form fields can be updated. The workaround is to exclude logical properties that are not on the HTML form explicitly.


*** Using a cursor
USE wws_Customer


*** Using a 'real' business object
loCust = CREATE("cCustomer")

*** Store form vars to oData properties

IF !loCust.Validate()
   THIS.Errormsg("Invalid Data")


*** Without an object passed in 
*** returns a new object with props for each form var
*** all vars are returned as text
loFormVars = Request.FormVarsToObject()

***Retrieve the txtName and txtCompany variables
lcName = loFormVars.txtName
lcCompany = loFormVars.txtCompany

See also:

Class wwrequest | wwRequest::UnbindFormVars

© West Wind Technologies, 1996-2021 • Updated: 03/06/21
Comment or report problem with topic