我能够在 HAML 中呈现表单,但我不确定如何验证它。
这是我到目前为止所拥有的:
#disclosure-form-container
= form_for([:mobile,@disclosure], :html => {:id => "disclosure-form", :remote => true}) do |f|
%p
=f.label :display_as, (t :select_disclosure_type)
=f.select :display_as, options_from_collection_for_select(Disclosure.basics, :display_as, :name, f.object.display_as)
%p
=f.label :notes, (t :notes)
=f.text_area :notes, :class => "#{validation_rules(:free_disclosure_notes)}", :rows => 5 , :id => "disclosure_notes_entry"
= buttonset({:submit_label => (t "buttons.influencers.disclosures.create"),:submit_css_class => "call-to-action",:cancel_url => "#",:direction => :left_to_right})
这会呈现一个包含两个字段和一个单击提交按钮的表单。但是如果人们只是输入提交而没有做太多事情呢?我在哪里放置验证码以及如何验证此表单?
谢谢!