i have been having trouble tableless models in rails 3.x. i've looked @ bunch of questions here on stack overflow , while i've tried implement them haven't figured out yet. want form not submit unless 2 text field tags have been filled. doesn't have check if valid data want basic check on form itself.
i have form code here:
<%= form_tag '/page' %> <%= label_tag %> <%= text_field_tag %> <%= label_tag %> <%= text_field_tag %> <br /> <%= submit_tag %> <% end %> which passes off controller:
def page @page = hourly.new(params) @page.function_call end which goes model:
class hourly include activemodel::validations attr_reader params attr_accessor params validates_presence_of params def initialize(params) end end is there not adding check validation of text_field_tags?
where submitting form data if it's tableless model? use jquery disable form button unless both of fields have value. or, better yet...use client_side_validations gem , set required validation 2 fields...it not allow form submitted if validation fails.
Comments
Post a Comment