Reference:FormField

From Bistro
Jump to: navigation, search

Contents

Overview

The FormField attribute indicates that the marked value represents a form value in the request.

Usage

This attribute is specified for Property and Field level usage. The value of this member will be set to the value of a Form element from the HttpRequest object with a matching name, if one is present, prior to execution.

Name

The name property can be used to redefine the name of the form field bound to this member. The value defaults to the name of the property or field marked.

Example

The following code demonstrates how to make a Form value available to the request context

[Bind("/postings/{contentType}")]
public class Search : AbstractController
{
    [FormField, Request]
    protected string txtQuery;
 
...
 
}

The following template will then submit, and display the previously submitted value

<form>
    <input name="txtQuery" value="{{txtQuery}}" />
    ...
</form>
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox