I have applied a validation in user model for the uniqueness of login
name. i.e.
validates_uniqueness_of :login, :message => “username already exists”.
When i click on submit button and the login already exists then message
is displayed:
1 error prohibited this user from being saved
There were problems with the following fields:
* Login username already exists
but the values in the textboxes can not be retained.
I want this validation and the values in the textboxes to be retained.
Are you trying the scaffold generator? We may need more information to
help you with this. Probably the best place to ask this kind of help
is to login into the irc freenode.
Are you trying the scaffold generator? We may need more information to
help you with this. Probably the best place to ask this kind of help
is to login into the irc freenode.
Actually I am implementing a registration form. In that I have applied a
validation in user model to validate the uniqueness of login.
validates_uniqueness_of :login, :message => “login already exists”
If the user login already exits then it displays the message login
already exists
but at the same time i want to retain the values in other fields like
first name, last name and so on.
Just render :action => “signup” should do the trick (without :layout and
:id), and the signup and the method where it actually puts a new record
into
the database should be two seperate actions. Currently in your code
it’ll
try to create a new user even when you’re viewing the page.
def create @rightpanels = Rightpanel.find(:all, :limit => 2, :order =>
‘rand()’) @countries = Country.find :all @user = User.new(params[:user])
salt=‘hex123folkstory’
@user.password=Digest::SHA1.hexdigest(params[:user][:password] +
salt)
if @user.save
flash[:notice] = ‘You will recieve a mail on your account with login
info and link, once the admin activates your account’
redirect_to :controller => ‘store’, :action => ‘login’
else
flash[:notice] = ‘This Login already Exist.Try Again!’
render :action => ‘sign_up’
end
end
Yes, please use the text_field tag helpers. It’s not difficult to put
javascript validations on there, as you can specify any attribute you
would
normally specify on the tag as another option in the tag.
Yes, please use the text_field tag helpers. It’s not difficult to put
javascript validations on there, as you can specify any attribute you
would
normally specify on the tag as another option in the tag.
Yes, please use the text_field tag helpers. It’s not difficult to put
javascript validations on there, as you can specify any attribute you
would
normally specify on the tag as another option in the tag.