1
0
Fork 0
oldhaven/app/views/user/update.erb

31 lines
1.2 KiB
Plaintext

<div id="registration">
<h1>Update ur profile!</h1>
<%= form_tag('/user/profile', :method => 'post') do -%>
<%= label_tag 'email', 'E-mail' %><%= email_field_tag 'email', @data.email %>
<%= label_tag 'name', 'Name' %><%= text_field_tag 'name', @data.name %>
<%= label_tag 'password', 'Password' %><%= password_field_tag 'password', nil %><div id="password_error"></div>
<%= label_tag 'password_c', 'Confirm' %><%= password_field_tag 'password_c', nil %><div id="password_c_error"></div>
<div class="complete">
<%= submit_tag 'I\'m done!' %>
</div>
<% end -%>
</div>
<script type="text/javascript" charset="utf-8">
$(function(){
$('#password').focus();
$('form').submit(function(){
$('#password_error, #password_c_error').html('');
if ($('#password').val().length > 0 && $('#password').val().length < 6) {
$('#password_error').html('* Password must be 6+ characters length');
$('#password').focus();
return false;
} else if ($('#password').val().length > 0 && $('#password').val() != $('#password_c').val()) {
$('#password_c_error').html('* Password and confirmation doesn\'t match');
$('#password_c').focus();
return false;
}
return true;
})
})
</script>