ruby - Using the Rails form_for "req" option -


i trying make ruby tag field required field client side , trying via:

<%= f.text_field :name, :placeholder => 'event title', :id => "form-field-first", :class => "form-field", :class => "req" %> 

but still submits no prob if field empty. more complicated this? have go in .rb file , make special required class? help!

as noted @ http://guides.rubyonrails.org/active_record_validations.html#presence,

you should use validates :field, presence: true in model.rb file this.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -