image_submit_tag(source, options = {})
Instance Public methods
Displays an image which when clicked will submit the form.
source
is passed to ActionView::Helpers::AssetUrlHelper#path_to_image
Options
-
:data
- This option can be used to add custom data attributes. -
: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.
Data attributes
-
confirm: 'question?'
- This will add a JavaScript confirm prompt with the question specified. If the user accepts, the form is processed normally, otherwise no action is taken.
Examples
image_submit_tag("login.png") # => <input alt="Login" src="/images/login.png" type="image" /> image_submit_tag("purchase.png", disabled: true) # => <input alt="Purchase" disabled="disabled" src="/images/purchase.png" type="image" /> image_submit_tag("search.png", class: 'search_button', alt: 'Find') # => <input alt="Find" class="search_button" src="/images/search.png" type="image" /> image_submit_tag("agree.png", disabled: true, class: "agree_disagree_button") # => <input alt="Agree" class="agree_disagree_button" disabled="disabled" src="/images/agree.png" type="image" /> image_submit_tag("save.png", data: { confirm: "Are you sure?" }) # => <input alt="Save" src="/images/save.png" data-confirm="Are you sure?" type="image" />
Please login to continue.