lundi 1 décembre 2014

Rails Responsive View


in my application at the moment of creating a user can select ins birth date by choosing a year a month and a day in three different dropdowns, at this moment the user is able to choose a future date as his birth date, what i'm trying to accomplish is a way to check if the user is selecting a valid date and warning him in case the date is invalid. I know i will need to use some javascript but i never used it in rails before. My main problem is how can i access the inputs from the js file. Thanks in advance.


Code that corresponds to the date selection part in the form:



<div class="control-group">
<%= f.label "Date of Birth (YYYY-MM-DD)", :class => 'control-label' %>
<div class="controls">
<%= f.select :year_Of_Birth , options_for_select((Time.now.year - 100)..(Time.zone.now.year )), :include_blank => true %>
<%= f.select :month_Of_Birth, 1..12 , :include_blank=> true %>
<%= f.select :day_Of_Birth, 1..31 , :include_blank => true %>
</div>
</div>




Aucun commentaire:

Enregistrer un commentaire