I want to disable the submit button until my input fields have been filled in. I am new to rails and not so much with JS and Coffee, I have been trying to run this feature but it is not getting to work. I also tried to validate on client side but could not make it work, the code passes but the button is still not enabled even when all fields are filled out. The button continues to be disenabled for some reason.
Html.haml
= simple_form_for @post, html: { multipart: true } do |f|
- if @post.errors.any?
#errors
%h2
= pluralize(@post.errors.count, "error")
prevented this Post from saving
%ul
- @post.errors.full_messages.each do |msg|
%li= msg
.form-group
= f.input :title,:label => "Project Name", input_html: { class: 'form-control' }
.form-group
%label{:for => "Image"} image
%input#image.form-control-file{"aria-describedby" => "fileHelp", :type => "file"}/
.form-group
%label{:for => "url-input"} Project Link
%input#url-input.form-control{:type => "url", :value => "https://"}/
.form-group
%label{:for => "description"} Description
%textarea#description.form-control{:rows => "3"}
%small#descriptionHelp.form-text.text-muted Clear it up please
%button#add.btn.btn-info{:type => "submit", :disabled => "disabled" } submit
Thanks in advance.