javascript form validation in rails?

Posted by Elliot on Stack Overflow See other posts from Stack Overflow or by Elliot
Published on 2010-06-06T20:07:00Z Indexed on 2010/06/06 20:32 UTC
Read the original article Hit count: 424

Hey guys,

I was wondering how to go about form validation in rails. Specifically, here is what I'm trying to do:

The form lets the user select an item from a drop down menu, and then enter a number along with it. Using RJS, the record instantly shows up in a table below the form. Resetting the form with AJAX isn't a problem.

The issue is, I don't want the person to be able to select the same item from that drop down menu twice (in 1 day at least). Without using ajax, this isn't a problem (as I have a function for the select statement currently), but now that the page isn't reloading, I need a way to make sure people cant add the same item twice in one day.

That said, is there a way to use some javascript/ajax validation to make sure the same record hasn't been submitted during that day, before a duplicate can be created?

Thanks in advance!

Elliot

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ruby-on-rails