0
@@ -6,7 +6,7 @@ module ActionView
0
# Provides a number of methods for creating form tags that doesn't rely on an Active Record object assigned to the template like
0
# FormHelper does. Instead, you provide the names and values manually.
0
- # NOTE: The HTML options <tt>disabled</tt>, <tt>readonly</tt>, and <tt>multiple</tt> can all be treated as booleans. So specifying
0
+ # NOTE: The HTML options <tt>disabled</tt>, <tt>readonly</tt>, and <tt>multiple</tt> can all be treated as booleans. So specifying
0
# <tt>:disabled => true</tt> will give <tt>disabled="disabled"</tt>.
0
# Starts a form tag that points the action to an url configured with <tt>url_for_options</tt> just like
0
@@ -20,15 +20,15 @@ module ActionView
0
# * A list of parameters to feed to the URL the form will be posted to.
0
# # => <form action="/posts" method="post">
0
- # form_tag('/posts/1', :method => :put)
0
+ # form_tag('/posts/1', :method => :put)
0
# # => <form action="/posts/1" method="put">
0
- # form_tag('/upload', :multipart => true)
0
+ # form_tag('/upload', :multipart => true)
0
# # => <form action="/upload" method="post" enctype="multipart/form-data">
0
# <% form_tag '/posts' do -%>
0
# <div><%= submit_tag 'Save' %></div>
0
@@ -88,7 +88,7 @@ module ActionView
0
# * <tt>:size</tt> - The number of visible characters that will fit in the input.
0
# * <tt>:maxlength</tt> - The maximum number of characters that the browser will allow the user to enter.
0
# * Any other key creates standard HTML attributes for the tag.
0
# text_field_tag 'name'
0
# # => <input id="name" name="name" type="text" />
0
@@ -146,13 +146,13 @@ module ActionView
0
# # => <input id="token" name="token" type="hidden" value="VUBJKB23UIVI1UU1VOBVI@" />
0
# hidden_field_tag 'collected_input', '', :onchange => "alert('Input collected!')"
0
- # # => <input id="collected_input" name="collected_input" onchange="alert('Input collected!')"
0
+ # # => <input id="collected_input" name="collected_input" onchange="alert('Input collected!')"
0
# # type="hidden" value="" />
0
def hidden_field_tag(name, value = nil, options = {})
0
text_field_tag(name, value, options.stringify_keys.update("type" => "hidden"))
0
- # Creates a file upload field. If you are using file uploads then you will also need
0
+ # Creates a file upload field. If you are using file uploads then you will also need
0
# to set the multipart option for the form tag:
0
# <%= form_tag { :action => "post" }, { :multipart => true } %>
0
@@ -160,7 +160,7 @@ module ActionView
0
- # The specified URL will then be passed a File object containing the selected file, or if the field
0
+ # The specified URL will then be passed a File object containing the selected file, or if the field
0
# was left blank, a StringIO object.
0
@@ -181,7 +181,7 @@ module ActionView
0
# # => <input id="resume" name="resume" type="file" value="~/resume.doc" />
0
# file_field_tag 'user_pic', :accept => 'image/png,image/gif,image/jpeg'
0
- # # => <input accept="image/png,image/gif,image/jpeg" id="user_pic" name="user_pic" type="file" />
0
+ # # => <input accept="image/png,image/gif,image/jpeg" id="user_pic" name="user_pic" type="file" />
0
# file_field_tag 'file', :accept => 'text/html', :class => 'upload', :value => 'index.html'
0
# # => <input accept="text/html" class="upload" id="file" name="file" type="file" value="index.html" />
0
@@ -286,7 +286,7 @@ module ActionView
0
tag :input, html_options
0
- # Creates a radio button; use groups of radio buttons named the same to allow users to
0
+ # Creates a radio button; use groups of radio buttons named the same to allow users to
0
# select from a group of options.
0
@@ -313,14 +313,14 @@ module ActionView
0
tag :input, html_options
0
- # Creates a submit button with the text <tt>value</tt> as the caption.
0
+ # Creates a submit button with the text <tt>value</tt> as the caption.
0
# * <tt>:confirm => 'question?'</tt> - This will add a JavaScript confirm
0
# prompt with the question specified. If the user accepts, the form is
0
# processed normally, otherwise no action is taken.
0
# * <tt>:disabled</tt> - If true, the user will not be able to use this input.
0
- # * <tt>:disable_with</tt> - Value of this parameter will be used as the value for a disabled version
0
+ # * <tt>:disable_with</tt> - Value of this parameter will be used as the value for a disabled version
0
# of the submit button when the form is submitted.
0
# * Any other key creates standard HTML options for the tag.
0
@@ -335,7 +335,7 @@ module ActionView
0
# # => <input disabled="disabled" name="commit" type="submit" value="Save edits" />
0
# submit_tag "Complete sale", :disable_with => "Please wait..."
0
- # # => <input name="commit" onclick="this.disabled=true;this.value='Please wait...';this.form.submit();"
0
+ # # => <input name="commit" onclick="this.disabled=true;this.value='Please wait...';this.form.submit();"
0
# # type="submit" value="Complete sale" />
0
# submit_tag nil, :class => "form_submit"
0
@@ -346,7 +346,7 @@ module ActionView
0
# # name="commit" type="submit" value="Edit" />
0
def submit_tag(value = "Save changes", options = {})
0
options.stringify_keys!
0
if disable_with = options.delete("disable_with")
0
"this.setAttribute('originalValue', this.value)",
0
@@ -358,15 +358,15 @@ module ActionView
0
if confirm = options.delete("confirm")
0
options["onclick"] ||= ''
0
options["onclick"] += "return #{confirm_javascript_function(confirm)};"
0
tag :input, { "type" => "submit", "name" => "commit", "value" => value }.update(options.stringify_keys)
0
# Displays an image which when clicked will submit the form.
0
# <tt>source</tt> is passed to AssetTagHelper#image_path
0
@@ -412,7 +412,7 @@ module ActionView
0
def html_options_for_form(url_for_options, options, *parameters_for_url)
0
returning options.stringify_keys do |html_options|
0
@@ -420,7 +420,7 @@ module ActionView
0
html_options["action"] = url_for(url_for_options, *parameters_for_url)
0
def extra_tags_for_form(html_options)
0
case method = html_options.delete("method").to_s
0
when /^get$/i # must be case-insentive, but can't use downcase as might be nil
0
@@ -434,12 +434,12 @@ module ActionView
0
content_tag(:div, tag(:input, :type => "hidden", :name => "_method", :value => method) + token_tag, :style => 'margin:0;padding:0')
0
def form_tag_html(html_options)
0
extra_tags = extra_tags_for_form(html_options)
0
tag(:form, html_options, true) + extra_tags
0
def form_tag_in_block(html_options, &block)
0
content = capture(&block)
0
concat(form_tag_html(html_options))