Home

Castle Stronghold

Table of contents

FormHelper API Document

The FormHelper allows you to output Html Input elements using the conventions necessary to use the DataBinder on the server side.

It also query the objects available on the context to show property values correctly, saving you the burden of filling text inputs, selects, checkboxes and radios.

Constructors

FormHelper()

Initializes a new instance of the Castle.MonoRail.Framework.Helpers.FormHelper class.

Methods

TextFieldValue(String target, Object value) : String

Generates an input text form element with the supplied value

ParameterDescription
target The object to get the value from and to be based on to create the element name.
value Value to supply to the element (instead of querying the target)

TextFieldValue(String target, Object value, IDictionary attributes) : String

Generates an input text form element with the supplied value

ParameterDescription
target The object to get the value from and to be based on to create the element name.
value Value to supply to the element (instead of querying the target)
attributes Attributes for the FormHelper method and for the html element it generates

TextField(String target) : String

Generates an input text element.

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.

TextField(String target, IDictionary attributes) : String

Generates an input text element.

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.
attributes Attributes for the FormHelper method and for the html element it generates

TextArea(String target) : String

Generates a textarea element.

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.

TextArea(String target, IDictionary attributes) : String

Generates a textarea element.

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.
attributes Attributes for the FormHelper method and for the html element it generates

PasswordField(String target) : String

Generates a password input field.

ParameterDescription
target The object to get the value from and to be based on to create the element name.

PasswordField(String target, IDictionary attributes) : String

Generates a password input field.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
attributes Attributes for the FormHelper method and for the html element it generates

TextFieldFormat(String target, String formatString) : String

Generates an input text element and formats the value with the specified format

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.
formatString The format string

TextFieldFormat(String target, String formatString, IDictionary attributes) : String

Generates an input text element and formats the value with the specified format

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.
formatString The format string
attributes Attributes for the FormHelper method and for the html element it generates

LabelFor(String target, String label) : String

Generates a label element.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
label Legend

LabelFor(String target, String label, IDictionary attributes) : String

Generates a label element.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
label Legend
attributes Attributes for the FormHelper method and for the html element it generates

HiddenField(String target) : String

Generates a hidden form element.

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.

HiddenField(String target, IDictionary attributes) : String

Generates a hidden form element.

The value is extracted from the target (if available)

ParameterDescription
target The object to get the value from and to be based on to create the element name.
attributes Attributes for the FormHelper method and for the html element it generates

CreateCheckboxList(String target, IEnumerable dataSource) : CheckboxList

Creates a Castle.MonoRail.Framework.Helpers.FormHelper.CheckboxList instance which is enumerable. For each interaction you can invoke Castle.MonoRail.Framework.Helpers.FormHelper.CheckboxList.Item which will correctly render a checkbox input element for the current element on the supplied set (dataSource).

The enumerable item will be an element of the dataSource.

If the dataSource elements are complex objects (ie not string or primitives), supply the parameters value and text to the dictionary to make the helper use the specified properties to extract the option value and content respectively.

Usually both the target and obviously the dataSource are sets with multiple items. The element types tend to be the same. If they are not, you might have to specify the suffix parameters on the attributes as it would not be inferred.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
dataSource The set of available elements

CreateCheckboxList(String target, IEnumerable dataSource, IDictionary attributes) : CheckboxList

Creates a Castle.MonoRail.Framework.Helpers.FormHelper.CheckboxList instance which is enumerable. For each interaction you can invoke Castle.MonoRail.Framework.Helpers.FormHelper.CheckboxList.Item which will correctly render a checkbox input element for the current element on the supplied set (dataSource).

The enumerable item will be an element of the dataSource.

If the dataSource elements are complex objects (ie not string or primitives), supply the parameters value and text to the dictionary to make the helper use the specified properties to extract the option value and content respectively.

Usually both the target and obviously the dataSource are sets with multiple items. The element types tend to be the same. If they are not, you might have to specify the suffix parameters on the attributes as it would not be inferred.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
dataSource The set of available elements
attributes Attributes for the FormHelper method and for the html element it generates

CheckboxField(String target) : String

Generates a checkbox field. In fact it generates two as a way to send a value if the primary checkbox is not checked. This allow the process the be aware of the unchecked value and act accordingly.

ParameterDescription
target The object to get the value from and to be based on to create the element name.

CheckboxField(String target, IDictionary attributes) : String

Generates a checkbox field. In fact it generates two as a way to send a value if the primary checkbox is not checked. This allow the process the be aware of the unchecked value and act accordingly.

The checked and unchecked values sent to the server defaults to true and false. You can override them using the parameters trueValue and falseValue.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
attributes Attributes for the FormHelper method and for the html element it generates

RadioField(String target, Object valueToSend) : String

Generates a radio input type with the specified value to send to the served in case the element in checked. It will automatically check the radio if the target evaluated value is equal to the specified valueToSend.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
valueToSend

RadioField(String target, Object valueToSend, IDictionary attributes) : String

Generates a radio input type with the specified value to send to the served in case the element in checked. It will automatically check the radio if the target evaluated value is equal to the specified valueToSend.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
valueToSend
attributes Attributes for the FormHelper method and for the html element it generates

Select(String target, IEnumerable dataSource) : String

Creates a select element and its options based on the dataSource. If the dataSource elements are complex objects (ie not string or primitives), supply the parameters value and text to the dictionary to make the helper use the specified properties to extract the option value and content respectively.

You can also specify the attribute firstoption to force the first option be something like 'please select'.

Usually the target is a single value and the dataSource is obviously a set with multiple items. The element types tend to be the same. If they are not, you might have to specify the suffix parameters on the attributes as it would not be inferred.

The target can also be a set. In this case the intersection will be the initially selected elements.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
dataSource The set of available elements

Select(String target, IEnumerable dataSource, IDictionary attributes) : String

Creates a select element and its options based on the dataSource. If the dataSource elements are complex objects (ie not string or primitives), supply the parameters value and text to the dictionary to make the helper use the specified properties to extract the option value and content respectively.

You can also specify the attribute firstoption to force the first option be something like 'please select'.

Usually the target is a single value and the dataSource is obviously a set with multiple items. The element types tend to be the same. If they are not, you might have to specify the suffix parameters on the attributes as it would not be inferred.

The target can also be a set. In this case the intersection will be the initially selected elements.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
dataSource The set of available elements
attributes Attributes for the FormHelper method and for the html element it generates

Select(String target, Object selectedValue, IEnumerable dataSource, IDictionary attributes) : String

Creates a select element and its options based on the dataSource. If the dataSource elements are complex objects (ie not string or primitives), supply the parameters value and text to the dictionary to make the helper use the specified properties to extract the option value and content respectively.

You can also specify the attribute firstoption to force the first option be something like 'please select'.

Usually the target is a single value and the dataSource is obviously a set with multiple items. The element types tend to be the same. If they are not, you might have to specify the suffix parameters on the attributes as it would not be inferred.

The target can also be a set. In this case the intersection will be the initially selected elements.

ParameterDescription
target The object to get the value from and to be based on to create the element name.
selectedValue
dataSource The set of available elements
attributes Attributes for the FormHelper method and for the html element it generates

CreateInputElement(String type, String target, Object value, IDictionary attributes) : String

Creates the specified input element using the specified parameters to supply the name, value, id and others html attributes.

ParameterDescription
type
target The object to get the value from and to be based on to create the element name.
value
attributes Attributes for the FormHelper method and for the html element it generates

CreateInputElement(String type, String id, String target, String value, IDictionary attributes) : String

Creates the specified input element using the specified parameters to supply the name, value, id and others html attributes.

ParameterDescription
type
id
target The object to get the value from and to be based on to create the element name.
value
attributes Attributes for the FormHelper method and for the html element it generates

ObtainValue(String target) : Object

Queries the context for the target value

ParameterDescription
target The object to get the value from and to be based on to create the element name.

ObtainValue(RequestContext context, String target) : Object

Queries the context for the target value

ParameterDescription
context
target The object to get the value from and to be based on to create the element name.

QueryPropertyRecursive(Object rootInstance, String[] propertyPath, Int32 piece) : Object

ParameterDescription
rootInstance
propertyPath
piece

ObtainRootInstance(RequestContext context, String target) : Object

ParameterDescription
context
target The object to get the value from and to be based on to create the element name.

CreateHtmlId(IDictionary attributes, String target) : String

Creates the HTML id.

ParameterDescription
attributes The attributes.
target The target.

CreateHtmlId(IDictionary attributes, String target, Boolean removeEntry) : String

Creates the HTML id.

ParameterDescription
attributes The attributes.
target The target.
removeEntry if set to true [remove entry].

ObtainEntry(IDictionary attributes, String key) : String

Obtains the entry.

ParameterDescription
attributes The attributes.
key The key.

ObtainEntryAndRemove(IDictionary attributes, String key, String defaultValue) : String

Obtains the entry and remove it if found.

ParameterDescription
attributes The attributes.
key The key.
defaultValue The default value.

ObtainEntryAndRemove(IDictionary attributes, String key) : String

Obtains the entry and remove it if found.

ParameterDescription
attributes The attributes.
key The key.

IsPresent(Object value, Object initialSetValue, PropertyInfo propertyOnInitialSet, Boolean isMultiple) : Boolean

Determines whether the present value matches the value on the initialSetValue (which can be a single value or a set)

ParameterDescription
value Value from the datasource
initialSetValue Value from the initial selection set
propertyOnInitialSet Optional. Property to obtain the value from
isMultipletrue if the initial selection is a set

GetMethod(Object elem, String property) : PropertyInfo

Gets the property get method.

Quick Note

This method is used to get the System.Reflection.MethodInfo to retrieve specified property from the specified type.

ParameterDescription
elem Object specifying the type for which to get the method.
property Property name.

GetMethod(Type type, String property) : PropertyInfo

Missing summary

ParameterDescription
type Missing documentation
property Missing documentation

Google
Search WWW Search castleproject.org