public Method

FormTagHelper.image_submit_tag(source, options = {})

Contents:

Displays an image which when clicked will submit the form.

source is passed to AssetTagHelper#image_path

Options

  • :disabled - If set to true, the user will not be able to use this input.
  • Any other key creates standard HTML options for the tag.

Examples

image_submit_tag("login.png")
# => <input src="/images/login.png" type="image" />

image_submit_tag("purchase.png"), :disabled => true
# => <input src="/images/purchase.png" type="image" disabled="disabled" />

image_submit_tag("search.png"), :class => 'search-button'
# => <input src="/images/search.png" type="image" />

image_submit_tag("agree.png"), :disabled => true, :class => "agree-disagree-button"
# => <input src="/images/agree.png" type="image" disabled="disabled" />

Source Code

# File action_view/helpers/form_tag_helper.rb, line 381
def image_submit_tag(source, options = {})
  tag :input, { "type" => "image", "src" => path_to_image(source) }.update(options.stringify_keys)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.