C# Класс Castle.MonoRail.Framework.Helpers.FormHelper

The FormHelper allows you to output html input elements using the conventions necessary to use the DataBinder on the server side. Ultimately it allows you do to a bi-directional binding -- if used properly.
Elements generation

Buttons Submit(string)
Button(string)
ButtonElement(string)
Select Select(string,IEnumerable) Text area TextArea(string) Hidden field HiddenField(string) Checkbox field CheckboxField(string)
CreateCheckboxList(string,IEnumerable)
Radio field RadioField(string,object) File upload FileField(string) Text field TextField(string)
TextFieldValue(string, object)
NumberField(string)
NumberFieldValue(string, object)
Password field PasswordField(string)
PasswordNumberField(string)
Labels LabelFor(string,string)
LabelFor(string,string,IDictionary)

FormValidation
The following operations are related to the Form Validation support:

FormTag(IDictionary) and EndFormTag Opens/close the form tag. They are required to use the form validation DisableValidation Disables validation altogether UseWebValidatorProvider Sets a custom Browser validator provider UsePrototypeValidation Configures the helper to use the prototype easy field validation. Must be invoked before FormTag UsefValidate Configures the helper to use the fValidate. Deprecated. UseZebdaValidation Configures the helper to use the Zebda. Must be invoked before FormTag

Mask support.
For most elements, you can use the entries mask and optionally mask_separator to define a mask for your inputs. Kudos to mordechai Sandhaus - 52action.com

For example: mask='2,5',mask_separator='/' will mask the content to '12/34/1234'

Наследование: AbstractHelper, IServiceEnabledComponent
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
FieldFlags BindingFlags
PropertyFlags BindingFlags
PropertyFlags2 BindingFlags
logger ILogger

Private Properties

Свойство Тип Описание
AddChecked void
ApplyFilterOptions void
ApplyNumberOnlyOptions void
AreEqual bool
AssertIsValidArray void
CheckForExistenceAndExtractIndex bool
CheckboxItem string
CollectValidators IValidator[]
CreateHtmlId string
GetArrayElement object
ObtainRootType System.Type
QueryPropertyInfoRecursive System.Reflection.PropertyInfo
RemoveChecked void
ResolveFlagsToUse BindingFlags
SafeHtmlEncode string

Открытые методы

Метод Описание
AjaxFormTag ( IDictionary parameters ) : string

Generate Ajax form tag for ajax based form submission. Experimental.

Button ( string value ) : string

Generates an input button element.

Button ( string value, IDictionary attributes ) : string

Generates an input button element.

ButtonElement ( string innerText ) : string

Creates a basic button element of type submit.

ButtonElement ( string innerText, string type ) : string

Creates a basic button element of the specified type.

ButtonElement ( string innerText, string type, IDictionary attributes ) : string

Creates a basic button element of the specified type and with specified attributes.

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.

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, but the DataBinder is prepared only to treat boolean arrays.

CreateCheckboxList ( string target, IEnumerable dataSource ) : CheckboxList

Creates a CheckboxList instance which is enumerable. For each interaction you can invoke 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.

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

Creates a CheckboxList instance which is enumerable. For each interaction you can invoke 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.

DisableValidation ( ) : void

Disables the validation.

EndFormTag ( ) : string

Renders an end form element.

Should be used if you are using form validation. Some validation approaches uses the end form before or after appending a javascript snippet.

EnumToPairs ( Type enumType ) : string>[].Pair

Creates a list of pairs for the enum type.

FileField ( string target ) : string

Generates an input file element.

Dirrently than other operations exposed by this helper, no value is extracted for this operation

FileField ( string target, IDictionary attributes ) : string

Generates an input file element.

Dirrently than other operations exposed by this helper, no value is extracted for this operation

FilteredTextField ( string target, IDictionary attributes ) : string

Generates an input text element with a javascript that prevents the chars listed in the forbid attribute from being entered.

You must invoke FormHelper.InstallScripts before using it.

FormTag ( IDictionary parameters ) : string

Creates a form tag based on the parameters.

Javascript validation can also be bound to the form and|or elements nested as long as the helper is able to reach the Type of the object used on your view code

The action attribute generation will use UrlHelper

The parameters are used to build a url and also to form the tag. For notes on the url see DefaultUrlBuilder.BuildUrl(UrlInfo,IDictionary). The other parameters supported follows noaction boolean. Disables the generation of an action method string. The http method to use. Defaults to post id string. The form id. More parameters can be accepted depending on the form validation strategy you are using (if any).

FormTag ( string url, IDictionary parameters ) : string

Creates a form tag based on the parameters.

Javascript validation can also be bound to the form and|or elements nested as long as the helper is able to reach the Type of the object used on your view code

The action attribute generation will use UrlHelper

The following parameters are accepted. method string. The http method to use. Defaults to post id string. The form id. More parameters can be accepted depending on the form validation strategy you are using (if any).

HiddenField ( string target ) : string

Generates a hidden form element.

The value is extracted from the target (if available)

HiddenField ( string target, IDictionary attributes ) : string

Generates a hidden form element.

The value is extracted from the target (if available)

HiddenField ( string target, object value ) : string

Generates a hidden form element with the specified value

HiddenField ( string target, object value, IDictionary attributes ) : string

Generates a hidden form element with the specified value

InstallScripts ( ) : string

Renders a Javascript library inside a single script tag.

LabelFor ( string target, string label ) : string

Generates a label element.

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

Generates a label element.

NumberField ( string target ) : string

Generates an input text element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You must include the formhelper javascript functions to use the NumberField. See InstallScripts

NumberField ( string target, IDictionary attributes ) : string

Generates an input text element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You must include the formhelper javascript functions to use the NumberField. See InstallScripts

You can optionally pass an exceptions value through the dictionary. It must be a comma separated list of chars that can be accepted on the field. For example:

FormHelper.NumberField("product.price", {exceptions='13,10,11'}) In this case the key codes 13, 10 and 11 will be accepted on the field.

You can aslo optionally pass an forbid value through the dictionary. It must be a comma separated list of chars that cannot be accepted on the field. For example:

FormHelper.NumberField("product.price", {forbid='46'}) In this case the key code 46 (period) will not be accepted on the field.
NumberFieldValue ( string target, object value ) : string

Generates an input text element with a javascript that prevents chars other than numbers from being entered. The value is not gathered from the context, instead you specify it on the second argument

You must include the formhelper javascript functions to use the NumberField. See InstallScripts

NumberFieldValue ( string target, object value, IDictionary attributes ) : string

Generates an input text element with a javascript that prevents chars other than numbers from being entered. The value is not gathered from the context, instead you specify it on the second argument

You must include the formhelper javascript functions to use the NumberField. See InstallScripts

PasswordField ( string target ) : string

Generates a password input field.

PasswordField ( string target, IDictionary attributes ) : string

Generates a password input field.

PasswordNumberField ( string target ) : string

Generates an input password element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You must invoke FormHelper.InstallScripts before using it

PasswordNumberField ( string target, IDictionary attributes ) : string

Generates an input password element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You can optionally pass an exceptions value through the dictionary. It must be a comma separated list of chars that can be accepted on the field. For example:

FormHelper.NumberField("product.price", {exceptions='13,10,11'}) In this case the key codes 13, 10 and 11 will be accepted on the field.

You can aslo optionally pass an forbid value through the dictionary. It must be a comma separated list of chars that cannot be accepted on the field. For example:

FormHelper.NumberField("product.price", {forbid='46'}) In this case the key code 46 (period) will not be accepted on the field.

You must invoke FormHelper.InstallScripts before using it

Pop ( ) : void

Pops this instance. Experimental.

Push ( string target ) : void

Pushes the specified target. Experimental.

Push ( string target, IDictionary parameters ) : void

Pushes the specified target. Experimental.

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.

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.

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'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

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.

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'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

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.

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'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

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.

Service ( IServiceProvider provider ) : void

Invoked by the framework in order to give a chance to obtain other services

Submit ( string value ) : string

Generates an input submit element.

Submit ( string value, IDictionary attributes ) : string

Generates an input submit element.

TextArea ( string target ) : string

Generates a textarea element.

The value is extracted from the target (if available)

TextArea ( string target, IDictionary attributes ) : string

Generates a textarea element.

The value is extracted from the target (if available)

TextAreaValue ( string target, object value, IDictionary attributes ) : string

Generates a textarea element with a specified value.

TextField ( string target ) : string

Generates an input text element.

The value is extracted from the target (if available)

TextField ( string target, IDictionary attributes ) : string

Generates an input text element.

The value is extracted from the target (if available)

TextFieldValue ( string target, object value ) : string

Generates an input text form element with the supplied value

TextFieldValue ( string target, object value, IDictionary attributes ) : string

Generates an input text form element with the supplied value

UsePrototypeValidation ( ) : void

Configures this FormHelper instance to use Prototype for form fields validation

UseWebValidatorProvider ( IBrowserValidatorProvider provider ) : void

Configures this FormHelper instance to use the supplied web validator to generate field validation.

UseZebdaValidation ( ) : void

Configures this FormHelper instance to use Zebda for form fields validation

UsefValidate ( ) : void

Configures this FormHelper instance to use fValidate for form fields validation

Защищенные методы

Метод Описание
ApplyValidation ( InputElementType inputType, string target, IDictionary &attributes ) : void

Applies the validation.

CreateHtmlId ( IDictionary attributes, string target ) : string

Creates the HTML id.

CreateHtmlId ( IDictionary attributes, string target, bool removeEntry ) : string

Creates the HTML id.

CreateInputElement ( string type, string value, IDictionary attributes ) : string

Creates the input element.

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.

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.

FormatIfNecessary ( object value, IDictionary attributes ) : string

Formats if necessary.

GenerateSelect ( string target, object selectedValue, IEnumerable dataSource, IDictionary attributes ) : string

Generates the select.

IsPresent ( object value, object initialSetValue, ValueGetter propertyOnInitialSet, bool isMultiple ) : bool

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

ObtainRootInstance ( RequestContext context, string target ) : object

Obtains the root instance.

ObtainRootInstance ( RequestContext context, string target, string &pieces ) : object

Obtains the root instance.

ObtainTargetProperty ( RequestContext context, string target, Action action ) : PropertyInfo

Obtains the target property.

ObtainValue ( RequestContext context, string target ) : object

Queries the context for the target value

ObtainValue ( string target ) : object

Queries the context for the target value

QueryPropertyRecursive ( object rootInstance, string propertyPath, int piece ) : object

RewriteTargetIfWithinObjectScope ( string target ) : string

Rewrites the target if within object scope.

Приватные методы

Метод Описание
AddChecked ( IDictionary attributes ) : void
ApplyFilterOptions ( IDictionary attributes ) : void
ApplyNumberOnlyOptions ( IDictionary attributes ) : void
AreEqual ( object left, object right ) : bool
AssertIsValidArray ( object instance, string property, int index ) : void
CheckForExistenceAndExtractIndex ( string &property, int &index ) : bool
CheckboxItem ( int index, string target, string suffix, Castle.MonoRail.Framework.Helpers.SetItem item, IDictionary attributes ) : string

Outputs a checkbox element (for internal use)

CollectValidators ( RequestContext requestContext, string target ) : IValidator[]
CreateHtmlId ( string name ) : string
GetArrayElement ( object instance, int index ) : object
ObtainRootType ( RequestContext context, string target, string &pieces ) : Type

Obtains the type of the root.

QueryPropertyInfoRecursive ( Type type, string propertyPath, int piece, Action action ) : PropertyInfo
RemoveChecked ( IDictionary attributes ) : void
ResolveFlagsToUse ( Type type ) : BindingFlags
SafeHtmlEncode ( string content ) : string

Описание методов

AjaxFormTag() публичный Метод

Generate Ajax form tag for ajax based form submission. Experimental.
public AjaxFormTag ( IDictionary parameters ) : string
parameters IDictionary
Результат string

ApplyValidation() защищенный Метод

Applies the validation.
protected ApplyValidation ( InputElementType inputType, string target, IDictionary &attributes ) : void
inputType InputElementType Type of the input.
target string The target.
attributes IDictionary The attributes.
Результат void

Button() публичный Метод

Generates an input button element.
public Button ( string value ) : string
value string The value.
Результат string

Button() публичный Метод

Generates an input button element.
public Button ( string value, IDictionary attributes ) : string
value string The value.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

ButtonElement() публичный Метод

Creates a basic button element of type submit.
public ButtonElement ( string innerText ) : string
innerText string The inner text of the button element.
Результат string

ButtonElement() публичный Метод

Creates a basic button element of the specified type.
public ButtonElement ( string innerText, string type ) : string
innerText string The inner text of the button element.
type string The type of the button.
Результат string

ButtonElement() публичный Метод

Creates a basic button element of the specified type and with specified attributes.
public ButtonElement ( string innerText, string type, IDictionary attributes ) : string
innerText string The inner text of the button element.
type string The type of the button.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

CheckboxField() публичный Метод

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.
public CheckboxField ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

CheckboxField() публичный Метод

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, but the DataBinder is prepared only to treat boolean arrays.

public CheckboxField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

CreateCheckboxList() публичный Метод

Creates a CheckboxList instance which is enumerable. For each interaction you can invoke 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.

public CreateCheckboxList ( string target, IEnumerable dataSource ) : CheckboxList
target string The object to get the value from and to be based on to create the element name.
dataSource IEnumerable The set of available elements
Результат CheckboxList

CreateCheckboxList() публичный Метод

Creates a CheckboxList instance which is enumerable. For each interaction you can invoke 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.

public CreateCheckboxList ( string target, IEnumerable dataSource, IDictionary attributes ) : CheckboxList
target string The object to get the value from and to be based on to create the element name.
dataSource IEnumerable The set of available elements
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат CheckboxList

CreateHtmlId() защищенный статический Метод

Creates the HTML id.
protected static CreateHtmlId ( IDictionary attributes, string target ) : string
attributes IDictionary The attributes.
target string The target.
Результат string

CreateHtmlId() защищенный статический Метод

Creates the HTML id.
protected static CreateHtmlId ( IDictionary attributes, string target, bool removeEntry ) : string
attributes IDictionary The attributes.
target string The target.
removeEntry bool if set to true [remove entry].
Результат string

CreateInputElement() защищенный Метод

Creates the input element.
protected CreateInputElement ( string type, string value, IDictionary attributes ) : string
type string The type.
value string The value.
attributes IDictionary The attributes.
Результат string

CreateInputElement() защищенный Метод

Creates the specified input element using the specified parameters to supply the name, value, id and others html attributes.
protected CreateInputElement ( string type, string target, Object value, IDictionary attributes ) : string
type string
target string The object to get the value from and to be based on to create the element name.
value Object
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

CreateInputElement() защищенный Метод

Creates the specified input element using the specified parameters to supply the name, value, id and others html attributes.
protected CreateInputElement ( string type, string id, string target, string value, IDictionary attributes ) : string
type string
id string
target string The object to get the value from and to be based on to create the element name.
value string
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

DisableValidation() публичный Метод

Disables the validation.
public DisableValidation ( ) : void
Результат void

EndFormTag() публичный Метод

Renders an end form element.
Should be used if you are using form validation. Some validation approaches uses the end form before or after appending a javascript snippet.
public EndFormTag ( ) : string
Результат string

EnumToPairs() публичный статический Метод

Creates a list of pairs for the enum type.
public static EnumToPairs ( Type enumType ) : string>[].Pair
enumType System.Type enum type.
Результат string>[].Pair

FileField() публичный Метод

Generates an input file element.

Dirrently than other operations exposed by this helper, no value is extracted for this operation

public FileField ( string target ) : string
target string The object to be based on when creating the element name.
Результат string

FileField() публичный Метод

Generates an input file element.

Dirrently than other operations exposed by this helper, no value is extracted for this operation

public FileField ( string target, IDictionary attributes ) : string
target string The object to be based on when creating the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

FilteredTextField() публичный Метод

Generates an input text element with a javascript that prevents the chars listed in the forbid attribute from being entered.
You must invoke FormHelper.InstallScripts before using it.
public FilteredTextField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

FormTag() публичный Метод

Creates a form tag based on the parameters.

Javascript validation can also be bound to the form and|or elements nested as long as the helper is able to reach the Type of the object used on your view code

The action attribute generation will use UrlHelper

The parameters are used to build a url and also to form the tag. For notes on the url see DefaultUrlBuilder.BuildUrl(UrlInfo,IDictionary). The other parameters supported follows noaction boolean. Disables the generation of an action method string. The http method to use. Defaults to post id string. The form id. More parameters can be accepted depending on the form validation strategy you are using (if any).
public FormTag ( IDictionary parameters ) : string
parameters IDictionary The parameters for the tag or for action and form validation generation.
Результат string

FormTag() публичный Метод

Creates a form tag based on the parameters.

Javascript validation can also be bound to the form and|or elements nested as long as the helper is able to reach the Type of the object used on your view code

The action attribute generation will use UrlHelper

The following parameters are accepted. method string. The http method to use. Defaults to post id string. The form id. More parameters can be accepted depending on the form validation strategy you are using (if any).
public FormTag ( string url, IDictionary parameters ) : string
url string The hardcoded url.
parameters IDictionary The parameters for the tag or for action and form validation generation.
Результат string

FormatIfNecessary() защищенный статический Метод

Formats if necessary.
protected static FormatIfNecessary ( object value, IDictionary attributes ) : string
value object The value.
attributes IDictionary The attributes.
Результат string

GenerateSelect() защищенный Метод

Generates the select.
protected GenerateSelect ( string target, object selectedValue, IEnumerable dataSource, IDictionary attributes ) : string
target string The target.
selectedValue object The selected value.
dataSource IEnumerable The data source.
attributes IDictionary The attributes.
Результат string

HiddenField() публичный Метод

Generates a hidden form element.

The value is extracted from the target (if available)

public HiddenField ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

HiddenField() публичный Метод

Generates a hidden form element.

The value is extracted from the target (if available)

public HiddenField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

HiddenField() публичный Метод

Generates a hidden form element with the specified value
public HiddenField ( string target, object value ) : string
target string The object to get the value from and to be based on to create the element name.
value object The value for the hidden field
Результат string

HiddenField() публичный Метод

Generates a hidden form element with the specified value
public HiddenField ( string target, object value, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
value object The value for the hidden field
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

InstallScripts() публичный Метод

Renders a Javascript library inside a single script tag.
public InstallScripts ( ) : string
Результат string

IsPresent() защищенный статический Метод

Determines whether the present value matches the value on the initialSetValue (which can be a single value or a set)
protected static IsPresent ( object value, object initialSetValue, ValueGetter propertyOnInitialSet, bool isMultiple ) : bool
value object Value from the datasource
initialSetValue object Value from the initial selection set
propertyOnInitialSet ValueGetter Optional. Property to obtain the value from
isMultiple bool true if the initial selection is a set
Результат bool

LabelFor() публичный Метод

Generates a label element.
public LabelFor ( string target, string label ) : string
target string The object to get the value from and to be based on to create the element name.
label string Legend
Результат string

LabelFor() публичный Метод

Generates a label element.
public LabelFor ( string target, string label, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
label string Legend
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

NumberField() публичный Метод

Generates an input text element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You must include the formhelper javascript functions to use the NumberField. See InstallScripts
public NumberField ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

NumberField() публичный Метод

Generates an input text element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You must include the formhelper javascript functions to use the NumberField. See InstallScripts

You can optionally pass an exceptions value through the dictionary. It must be a comma separated list of chars that can be accepted on the field. For example:

FormHelper.NumberField("product.price", {exceptions='13,10,11'}) In this case the key codes 13, 10 and 11 will be accepted on the field.

You can aslo optionally pass an forbid value through the dictionary. It must be a comma separated list of chars that cannot be accepted on the field. For example:

FormHelper.NumberField("product.price", {forbid='46'}) In this case the key code 46 (period) will not be accepted on the field.
public NumberField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

NumberFieldValue() публичный Метод

Generates an input text element with a javascript that prevents chars other than numbers from being entered. The value is not gathered from the context, instead you specify it on the second argument
You must include the formhelper javascript functions to use the NumberField. See InstallScripts
public NumberFieldValue ( string target, object value ) : string
target string The object to get the value from and to be based on to create the element name.
value object The current value to output.
Результат string

NumberFieldValue() публичный Метод

Generates an input text element with a javascript that prevents chars other than numbers from being entered. The value is not gathered from the context, instead you specify it on the second argument
You must include the formhelper javascript functions to use the NumberField. See InstallScripts
public NumberFieldValue ( string target, object value, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
value object The current value to output.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

ObtainRootInstance() защищенный Метод

Obtains the root instance.
protected ObtainRootInstance ( RequestContext context, string target ) : object
context RequestContext The context.
target string The object to get the value from and to be based on to create the element name.
Результат object

ObtainRootInstance() защищенный Метод

Obtains the root instance.
protected ObtainRootInstance ( RequestContext context, string target, string &pieces ) : object
context RequestContext The context.
target string The target.
pieces string The pieces.
Результат object

ObtainTargetProperty() защищенный Метод

Obtains the target property.
protected ObtainTargetProperty ( RequestContext context, string target, Action action ) : PropertyInfo
context RequestContext The context.
target string The target.
action Action The action.
Результат System.Reflection.PropertyInfo

ObtainValue() защищенный Метод

Queries the context for the target value
protected ObtainValue ( RequestContext context, string target ) : object
context RequestContext
target string The object to get the value from and to be based on to create the element name.
Результат object

ObtainValue() защищенный Метод

Queries the context for the target value
protected ObtainValue ( string target ) : object
target string The object to get the value from and to be based on to create the element name.
Результат object

PasswordField() публичный Метод

Generates a password input field.
public PasswordField ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

PasswordField() публичный Метод

Generates a password input field.
public PasswordField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

PasswordNumberField() публичный Метод

Generates an input password element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You must invoke FormHelper.InstallScripts before using it
public PasswordNumberField ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

PasswordNumberField() публичный Метод

Generates an input password element with a javascript that prevents chars other than numbers from being entered.

The value is extracted from the target (if available)

You can optionally pass an exceptions value through the dictionary. It must be a comma separated list of chars that can be accepted on the field. For example:

FormHelper.NumberField("product.price", {exceptions='13,10,11'}) In this case the key codes 13, 10 and 11 will be accepted on the field.

You can aslo optionally pass an forbid value through the dictionary. It must be a comma separated list of chars that cannot be accepted on the field. For example:

FormHelper.NumberField("product.price", {forbid='46'}) In this case the key code 46 (period) will not be accepted on the field.
You must invoke FormHelper.InstallScripts before using it
public PasswordNumberField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

Pop() публичный Метод

Pops this instance. Experimental.
public Pop ( ) : void
Результат void

Push() публичный Метод

Pushes the specified target. Experimental.
public Push ( string target ) : void
target string The target.
Результат void

Push() публичный Метод

Pushes the specified target. Experimental.
public Push ( string target, IDictionary parameters ) : void
target string The target.
parameters IDictionary The parameters.
Результат void

QueryPropertyRecursive() защищенный Метод

protected QueryPropertyRecursive ( object rootInstance, string propertyPath, int piece ) : object
rootInstance object
propertyPath string
piece int
Результат object

RadioField() публичный Метод

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.
public RadioField ( string target, object valueToSend ) : string
target string The object to get the value from and to be based on to create the element name.
valueToSend object
Результат string

RadioField() публичный Метод

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.
public RadioField ( string target, object valueToSend, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
valueToSend object
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

RewriteTargetIfWithinObjectScope() защищенный Метод

Rewrites the target if within object scope.
protected RewriteTargetIfWithinObjectScope ( string target ) : string
target string The target.
Результат string

Select() публичный Метод

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'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

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.

public Select ( string target, IEnumerable dataSource ) : string
target string The object to get the value from and to be based on to create the element name.
dataSource IEnumerable The set of available elements
Результат string

Select() публичный Метод

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'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

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.

public Select ( string target, IEnumerable dataSource, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
dataSource IEnumerable The set of available elements
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

Select() публичный Метод

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'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

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.

public Select ( string target, object selectedValue, IEnumerable dataSource, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
selectedValue object
dataSource IEnumerable The set of available elements
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

Service() публичный Метод

Invoked by the framework in order to give a chance to obtain other services
public Service ( IServiceProvider provider ) : void
provider IServiceProvider The service proviver
Результат void

Submit() публичный Метод

Generates an input submit element.
public Submit ( string value ) : string
value string The value/caption for the button.
Результат string

Submit() публичный Метод

Generates an input submit element.
public Submit ( string value, IDictionary attributes ) : string
value string The value/caption for the button.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

TextArea() публичный Метод

Generates a textarea element.

The value is extracted from the target (if available)

public TextArea ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

TextArea() публичный Метод

Generates a textarea element.

The value is extracted from the target (if available)

public TextArea ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

TextAreaValue() публичный Метод

Generates a textarea element with a specified value.
public TextAreaValue ( string target, object value, IDictionary attributes ) : string
target string The target to base the element name on.
value object The value to apply to the field.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

TextField() публичный Метод

Generates an input text element.

The value is extracted from the target (if available)

public TextField ( string target ) : string
target string The object to get the value from and to be based on to create the element name.
Результат string

TextField() публичный Метод

Generates an input text element.

The value is extracted from the target (if available)

public TextField ( string target, IDictionary attributes ) : string
target string The object to get the value from and to be based on to create the element name.
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

TextFieldValue() публичный Метод

Generates an input text form element with the supplied value
public TextFieldValue ( string target, object value ) : string
target string The string to be used to create the element name.
value object Value to supply to the element (instead of querying the target)
Результат string

TextFieldValue() публичный Метод

Generates an input text form element with the supplied value
public TextFieldValue ( string target, object value, IDictionary attributes ) : string
target string The string to be used to create the element name.
value object Value to supply to the element (instead of querying the target)
attributes IDictionary Attributes for the FormHelper method and for the html element it generates
Результат string

UsePrototypeValidation() публичный Метод

Configures this FormHelper instance to use Prototype for form fields validation
public UsePrototypeValidation ( ) : void
Результат void

UseWebValidatorProvider() публичный Метод

Configures this FormHelper instance to use the supplied web validator to generate field validation.
public UseWebValidatorProvider ( IBrowserValidatorProvider provider ) : void
provider IBrowserValidatorProvider The validation provider.
Результат void

UseZebdaValidation() публичный Метод

Configures this FormHelper instance to use Zebda for form fields validation
public UseZebdaValidation ( ) : void
Результат void

UsefValidate() публичный Метод

Configures this FormHelper instance to use fValidate for form fields validation
public UsefValidate ( ) : void
Результат void

Описание свойств

FieldFlags защищенное статическое свойство

Common field flags for reflection
protected static BindingFlags FieldFlags
Результат BindingFlags

PropertyFlags защищенное статическое свойство

Common property flags for reflection
protected static BindingFlags PropertyFlags
Результат BindingFlags

PropertyFlags2 защищенное статическое свойство

Common property flags for reflection (with declared only)
protected static BindingFlags PropertyFlags2
Результат BindingFlags

logger защищенное свойство

Logger instance
protected ILogger logger
Результат ILogger