wwrequest::FormChecked

A form helper function that simplifies setting HTML listvalues to server PostBack values with expressions. This function returns checked="checked" when the form value matches the provided value or an empty string if the value or form var is false.

This method aims to make it easier to use static HTML and reassign postback values more easily. Without this function the expression would have to use an IIF() function and the following code is a little easier to read and write:

<input type="checkbox" name="IsActive" id="IsActive"
       <%= Request.FormChecked("IsActive") %>  />

The above will default to the first selected item when there's no postback or the form variable is not found. If you want to provide a preselected value then you can pass an optional model value:

<input type="checkbox" name="IsActive" id="IsActive"
       <%= Request.FormChecked("IsActive",poParms.IsActive) %> />
o.FormChecked(lcFormKey, lcValue, lcModelValue)

Return Value

If the lcValue matches the Form Var or Model Value, checked="checked" otherwise "".

Parameters

lcFormKey
The name of the form variable.

lcValue
The value to match. If the Form key matches the value specified the value

lcModelValue
Value used when the request is not a POST back or the lcFormKey doesn't exist.


See also:

Class wwrequest

© West Wind Technologies, 1996-2024 • Updated: 03/24/16
Comment or report problem with topic