form_tag
Form Tag Helpers
The form_tag module is accessible via the railshelpers.helpers module.
Functions
f form(url) ...
Starts a form tag that points the action to an url.
The url options should be given either as a string, or as a url() function. The method for the form defaults to POST.
Options:
- multipart - If set to True, the enctype is set to "multipart/form-data".
- method - The method to use when submitting the form, usually either "get" or "post".
f start_form(url) ...
Starts a form tag that points the action to an url.
The url options should be given either as a string, or as a url() function. The method for the form defaults to POST.
Options:
- multipart - If set to True, the enctype is set to "multipart/form-data".
- method - The method to use when submitting the form, usually either "get" or "post".
f select(name, option_tags='') ...
Creates a dropdown selection box
option_tags is a string containing the option tags for the select box:
>>> select("people", "<option>George</option>")
<select id="people" name="people"><option>George</option></select>
Options:
- multiple - If set to true the selection will allow multiple choices.
f text_field(name, value=None) ...
Creates a standard text field.
value is a string that will the contents of the text field will be set to
Options:
- disabled - If set to True, the user will not be able to use this input.
- size - The number of visible characters that will fit in the input.
- maxlength - The maximum number of characters that the browser will allow the user to enter.
Remaining keyword options will be standard HTML options for the tag.
f file_field(name, value=None) ...
Creates a file upload field.
If you are using file uploads then you will also need to set the multipart option for the form.
f password_field(name='password', value=None) ...
Creates a password field
Takes the same options as text_field
f text_area(name, content='') ...
Creates a text input area.
Options:
- size - A string specifying the dimensions of the textarea.
Example:
>>> text_area("body", '', size="25x10")
<textarea name="body" id="body" cols="25" rows="10"></textarea>
f submit(value='Save changes', name='commit') ...
Creates a submit button with the text value as the caption.
If options contains a keyword pair with the key of "disable_with", then the value will be used to rename a disabled version of the submit button.
See the source for more information.