Ruchita Sharma
2007-Dec-24 12:40 UTC
How to retain the values of textboxes if validation is there
Hi all, 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. Any help would be greatly appreciated. Thanks, Ruchita. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jean-Sébastien
2007-Dec-24 14:59 UTC
Re: 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 On Dec 24, 1:40 pm, Ruchita Sharma <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi all, > > 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. > > Any help would be greatly appreciated. > > Thanks, > Ruchita. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
blj
2007-Dec-24 16:02 UTC
Re: How to retain the values of textboxes if validation is there
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. On Dec 24, 5:40 pm, Ruchita Sharma <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi all, > > 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. > > Any help would be greatly appreciated. > > Thanks, > Ruchita. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 05:44 UTC
Re: How to retain the values of textboxes if validation is t
blj wrote:> 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. > > On Dec 24, 5:40 pm, Ruchita Sharma <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Hi all, 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. Any help would be greatly appreciated. Thanks, Ruchita. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-27 05:49 UTC
Re: How to retain the values of textboxes if validation is t
Actually the best place to ask is right here. Could you show us the code you''re using in your create action Ruchita? On Dec 27, 2007 4:14 PM, Ruchita Sharma <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > blj wrote: > > 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. > > > > On Dec 24, 5:40 pm, Ruchita Sharma <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > Hi all, > > 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. > > > Any help would be greatly appreciated. > > Thanks, > Ruchita. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 06:09 UTC
Re: How to retain the values of textboxes if validation is t
Try using the ''form_for'' tag in the view file. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 06:16 UTC
Re: How to retain the values of textboxes if validation is t
Ryan Bigg wrote:> Actually the best place to ask is right here. > > Could you show us the code you''re using in your create action Ruchita? > > On Dec 27, 2007 4:14 PM, Ruchita Sharma > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> Actually I am implementing a registration form. In that I have applied a >> Thanks, >> Ruchita. >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.The code for signup is: def signup @rightpanels = Rightpanel.find(:all, :limit => 2, :order => ''rand()'') @countries = Country.find :all @user = User.new @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'' , :layout => true, :id => @user.id # redirect_to :action => ''sign_up'', :controller => ''store'' end end User model is: validates_uniqueness_of :login, :message => "username already exists" This is the code of controller and model. Thanks, Ruchita. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-27 06:19 UTC
Re: How to retain the values of textboxes if validation is t
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. On Dec 27, 2007 4:46 PM, Ruchita Sharma <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ryan Bigg wrote: > > Actually the best place to ask is right here. > > > > Could you show us the code you''re using in your create action Ruchita? > > > > On Dec 27, 2007 4:14 PM, Ruchita Sharma > > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > > >> Actually I am implementing a registration form. In that I have applied > a > >> Thanks, > >> Ruchita. > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > >> > > >> > > > > > > -- > > Ryan Bigg > > http://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email. > > The code for signup is: > def signup > @rightpanels = Rightpanel.find(:all, :limit => 2, :order => ''rand()'') > @countries = Country.find :all > @user = User.new > @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'' , :layout => true, :id => @user.id > # redirect_to :action => ''sign_up'', :controller => ''store'' > end > end > > User model is: > validates_uniqueness_of :login, :message => "username already exists" > > This is the code of controller and model. > > Thanks, > Ruchita. > > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 06:27 UTC
Re: How to retain the values of textboxes if validation is t
Ok.... shall i split the code for signup and create? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-27 06:28 UTC
Re: How to retain the values of textboxes if validation is t
Yes, that''s what you should do. On Dec 27, 2007 4:57 PM, Ruchita Sharma <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Ok.... shall i split the code for signup and create? > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 06:32 UTC
Re: How to retain the values of textboxes if validation is t
Ryan Bigg wrote:> Yes, that''s what you should do. > > On Dec 27, 2007 4:57 PM, Ruchita Sharma > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> >> >> Ok.... shall i split the code for signup and create? >> -- >> Posted via http://www.ruby-forum.com/. > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.I have split the code for signup and create even then it''s not working. def signup @rightpanels = Rightpanel.find(:all, :limit => 2, :order => ''rand()'') @countries = Country.find :all @user = User.new end 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 Please tell me what needs to be done? Thanks, Ruchita. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 06:40 UTC
Re: How to retain the values of textboxes if validation is t
Can you please show your ''sign_up.rhtml'' view file also? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 06:45 UTC
Re: How to retain the values of textboxes if validation is t
Karthi kn wrote:> Can you please show your ''sign_up.rhtml'' view file also?It is a very big file. Let me show you only two fields from that file with form tag. Javascript validations are also there. <form name="signup" action="/store/create" method="post" onsubmit=''return checkForm()''> <table cellpadding="0" cellspacing="0" border="0" width="98%" style="color:#666633"> <tr> <td align="center" colspan="2">Please fill this form for registeration</td> </tr> <tr> <td align="center" colspan="2">Note: Fields marked with <span style="color:#ff0000">*</span> are mandatory</td></ br> </tr> <tr><td> </td></tr> <tr bgcolor="#F5F2D8"> <td width="27%" style="text-align:right; padding-right:10px" valign="top"><span style="color:#ff0000">*</span>Login </td> <td><input type="text" id="login" name="user[login]" value="" class="textFields"/></td> </tr> <td style="text-align:right; padding-right:10px" valign="top"><span style="color:#ff0000">*</span>Password </td> <td><input type="password" id="password" name="user[password]" value="" class="textFields" /></td> </tr> <tr bgcolor="#F5F2D8"> <td style="text-align:right; padding-right:10px" valign="top"><span style="color:#ff0000">*</span>Confirm Password </td> <td><input type="password" id="password1" name="user[password]" value="" class="textFields" /></td> </tr> </form> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 06:51 UTC
Re: How to retain the values of textboxes if validation is t
Ruchita Sharma wrote:> Karthi kn wrote: >> Can you please show your ''sign_up.rhtml'' view file also? > > It is a very big file. > Let me show you only two fields from that file with form tag. > Javascript validations are also there. > > <form name="signup" action="/store/create" method="post" > onsubmit=''return checkForm()''> > <table cellpadding="0" cellspacing="0" border="0" width="98%" > style="color:#666633"> > <tr> > <td align="center" colspan="2">Please fill this form for > registeration</td> > </tr> > <tr> > <td align="center" colspan="2">Note: Fields marked with <span > style="color:#ff0000">*</span> are mandatory</td></ br> > </tr> > <tr><td> </td></tr> > <tr bgcolor="#F5F2D8"> > <td width="27%" style="text-align:right; padding-right:10px" > valign="top"><span style="color:#ff0000">*</span>Login </td> > <td><input type="text" id="login" name="user[login]" value="" > class="textFields"/></td> > </tr> > > <td style="text-align:right; padding-right:10px" valign="top"><span > style="color:#ff0000">*</span>Password </td> > <td><input type="password" id="password" name="user[password]" value="" > class="textFields" /></td> > </tr> > > <tr bgcolor="#F5F2D8"> > <td style="text-align:right; padding-right:10px" valign="top"><span > style="color:#ff0000">*</span>Confirm Password </td> > <td><input type="password" id="password1" name="user[password]" value="" > class="textFields" /></td> > </tr> > > </form>Change the id of the text tag to ''user_login'' and is same with the other fields. <td><input type="text" id="user_login" name="user[login]" value=""> class="textFields"/></td>My suggestion is that, it will be much better if you start using the rails ''text_field'' tag instead of html ''input type="text"'' tag. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 06:55 UTC
Re: How to retain the values of textboxes if validation is t
If i user rails tag then it is difficult to put javascript validations. That is the reason I have done it with html tags. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 06:59 UTC
Re: How to retain the values of textboxes if validation is t
Ruchita Sharma wrote:> > If i user rails tag then it is difficult to put javascript validations. > That is the reason I have done it with html tags.Ok. Did you try changing the id of the input text field? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-27 06:59 UTC
Re: How to retain the values of textboxes if validation is t
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. <%= text_field "user", "login", { :onclick => "alert(''test'')" } %> You''re also typing value="" in your text fields, so they can''t have any values! The text_field helper will automatically fill in these values for you. -- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 07:02 UTC
Re: How to retain the values of textboxes if validation is t
Ryan Bigg wrote:> 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. > > <%= text_field "user", "login", { :onclick => "alert(''test'')" } %> > > You''re also typing value="" in your text fields, so they can''t have any > values! The text_field helper will automatically fill in these values > for > you.Yes. '' value="" '' should not be there in the input tag. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 07:14 UTC
Re: How to retain the values of textboxes if validation is t
Karthi kn wrote:> Ryan Bigg wrote: >> 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. >> >> <%= text_field "user", "login", { :onclick => "alert(''test'')" } %> >> >> You''re also typing value="" in your text fields, so they can''t have any >> values! The text_field helper will automatically fill in these values >> for >> you. > > > Yes. '' value="" '' should not be there in the input tag.I have checked it by changing the id as user_login and by deleting the value="". Its not working. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 07:22 UTC
Re: How to retain the values of textboxes if validation is t
> I have checked it by changing the id as user_login and by deleting the > value="". > Its not working.Is it throwing any exception or is the value not retained in UI? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruchita Sharma
2007-Dec-27 07:25 UTC
Re: How to retain the values of textboxes if validation is t
Karthi kn wrote:> >> I have checked it by changing the id as user_login and by deleting the >> value="". >> Its not working. > > > Is it throwing any exception or is the value not retained in UI?Not throwing any exception..... but it is not retaining the values in the textfields. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Karthi kn
2007-Dec-27 07:34 UTC
Re: How to retain the values of textboxes if validation is t
Ruchita Sharma wrote:> Karthi kn wrote: >> >>> I have checked it by changing the id as user_login and by deleting the >>> value="". >>> Its not working. >> >> >> Is it throwing any exception or is the value not retained in UI? > > Not throwing any exception..... but it is not retaining the values in > the textfields.Try adding '' value="#{@user.login}" '' in input tag. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-28 01:21 UTC
Re: How to retain the values of textboxes if validation is t
GAH! Just *please* use the text_field helpers. They set all this information FOR YOU. <%= text_field "user", "login", :onclick => "alert(''test'')" %> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---