i have form register using rails..
So basically I need to make feature that if you type ID on Field ID, it will be automatically
If you type in the ID field
- The first 4 digits directly (automatically) to generate to year
- The next 2 digits will be directly (automatically) to generate to month
- The next 2 digits will be directly (automatically) to generate to date
i use datepicker for date field..
on _form.html.erb
<div class="field">
<%= f.label :id, "ID" %><br />
<%= f.text_field :id %>
</div>
<div class="field">
<%= f.label :dob, "Date Of Birth (YY-MM-DD)" %><br />
<%= f.text_field :dob %>
</div>
users.js.coffee
jQuery ->
$('#user_tanggallahir').datepicker({ dateFormat: 'yy-mm-dd' })
i want type on field automatically of date..
Update
i have javascript such as http://jsfiddle.net/f8rUF/10/
but, i want format of date (dob) field such as 1990-01-12 (YY-MM-DD)
Hope you can help me with this ;)!
Update Solved..
i use substring to get 8 string
http://jsfiddle.net/f8rUF/19/