I'm using Simple Form with Rails 3.2. I'm currently adding the same classes to the submit button of each form within my app. There are a lot of forms so this isn't very DRY.
<%= f.button :submit, class: "form-submit" %>
Is there a way to configure Simple Form to use a default class for all submit buttons?
method property represents the HTTP method used to submit the <form> . Unless explicitly specified, the default method is 'get'.
The simplest way to do this is by using the WordPress CSS Editor. To open this, go to Appearance » Customize and select Additional CSS. Once you've opened the Additional CSS section, you can paste in your new CSS, click the Save & Publish button, and you're all set!
It is also created using HTML <input> tag but type attribute is set to button. You can try to run the following code to use submit button to submit and reset a form. Under the action, attribute add the file, where you want to reach after clicking Submit button.
Actually it is possible to add default class to button in simple form. In config/initializers/simple_form.rb:
SimpleForm.setup do |config|
# Default class for buttons
config.button_class = 'btn form-submit'
end
Tested in Simple Form 3.0.1 Remember to restart server after making changes to files in initializers directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With