How to retain the values of textboxes if validation is there

you should work on @user in your controller, then
text_field(:user, :login) will be full fill with @user.login