wwrequest::FormOrValue

Returns a value first by checking the Form variable in the Request buffer, and if it doesn't exist (or the request isn't POSTBACK) returning the value.

Use this function to get data depending on whether the request is a postback operation or not. On first hit use the model to drive the value. On subsequent hits when data has been entered use the form data instead.

This is especially useful in Scripts and templates where you need to bind the value="" property using < %= % > expressions to ensure that you get the post back values displayed when binding errors occur.

o.FormOrValue(lcFormKey, lvValue)

Return Value

string value of either the form value or the value provided

Parameters

lcFormKey
Name of the form variable to retrieve, if request is a POSTBACK and the form variable exists.

lvValue
The value to assign if no form value exists. Typically this value will come from your model. If this value is not a string TRANSFORM() is used to format the output to string.

Example

<input id="title" name="title" class="form-control" 
       value="<%= Request.FormOrValue('title',poEntry.Title) %>"/>

See also:

Class wwrequest

© West Wind Technologies, 1996-2022 • Updated: 11/25/15
Comment or report problem with topic