Hi all, i am using the normal rails error checking that comes with scaffold. Now I a password_confirmation field in my form - which is not in my database the confirmation checking works perfect and a text will be shown in the error box if the 2 password fields are not equal. My problem is, that the border around the password_confirmation field will not get red - when the password_confirmation field throws an error. any idea - what I can do? thanks for any help Andreas my code: <label for="user_password">Password:</label><br/> <%= password_field ''user'', ''password'',{ :maxlength => ''16'', :size => ''30'', :class => ''input'' } %> <label for="user_password_confirmation">Confirm Password:</label><br/> <%= password_field ''user'', ''password_confirmation'', { :maxlength => ''16'', :size => ''30'', :class => ''input'' } %> -- 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 -~----------~----~----~----~------~----~------~--~---
On 2-nov-2006, at 14:55, Andreas Schneider wrote:> > Hi all, > > i am using the normal rails error checking that comes with scaffold. > Now I a password_confirmation field in my form - which is not in my > database > > the confirmation checking works perfect and a text will be shown in > the > error box if the 2 password fields are not equal. > My problem is, that the border around the password_confirmation field > will not get red - when the password_confirmation field throws an > error. > > any idea - what I can do?Do you have a css tag for scaffold in your layout? gr, bartz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider wrote:> > <label for="user_password">Password:</label><br/> > <%= password_field ''user'', ''password'',{ :maxlength => ''16'', :size => > ''30'', :class => ''input'' } %> > > <label for="user_password_confirmation">Confirm Password:</label><br/> > <%= password_field ''user'', ''password_confirmation'', { :maxlength => > ''16'', :size => ''30'', :class => ''input'' } %>View the html source of the generated html when an error is thrown and write down "id" of the element that you want to color red and then edit your .css accordingly. (If you are using the scaffolding generator then most likely the .css you are linking to is scaffold.css) -- 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider
2006-Nov-02 16:41 UTC
Re: Scaffold Password Confirmation => no red border
do you think it is a css problem? I dont think so. when I look at my html output after an error in the field "password", I see this: <label for="user_password">Password:</label> <div class="fieldWithErrors"> <input class="input" id="user_password" maxlength="16" name="user[password]" size="30" type="password" value="" /> </div> <label for="user_password_confirmation">Confirm Password:</label> <input class="input" id="user_password_confirmation" maxlength="16" name="user[password_confirmation]" size="30" type="password" value="" /> as you can see - rails did a div with the error box around my text field from the password - but not at the password_confirmation field. Ilan Berci wrote:> Andreas Schneider wrote: >> >> <label for="user_password">Password:</label><br/> >> <%= password_field ''user'', ''password'',{ :maxlength => ''16'', :size => >> ''30'', :class => ''input'' } %> >> >> <label for="user_password_confirmation">Confirm Password:</label><br/> >> <%= password_field ''user'', ''password_confirmation'', { :maxlength => >> ''16'', :size => ''30'', :class => ''input'' } %> > > View the html source of the generated html when an error is thrown and > write down "id" of the element that you want to color red and then edit > your .css accordingly. > > (If you are using the scaffolding generator then most likely the .css > you are linking to is scaffold.css)-- 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider wrote:> > > do you think it is a css problem? I dont think so. >please insert the following into your .css file and refresh: #user_password_confirmation { border: 2px solid red } ilan -- 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider
2006-Nov-02 17:13 UTC
Re: Scaffold Password Confirmation => no red border
well, I dont need to insert this because I dont want a red border around my confirmation field - all the time only when an error occured Ilan Berci wrote:> Andreas Schneider wrote: >> >> >> do you think it is a css problem? I dont think so. >> > > > please insert the following into your .css file and refresh: > > #user_password_confirmation { > border: 2px solid red > } > > ilan-- 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 -~----------~----~----~----~------~----~------~--~---
I think, you should check your layouts *.rhtml file. In the header must be the following code: <%= stylesheet_link_tag ''scaffold'', :media => ''all'' %> (if you use scaffold.css) If you use your owen .css -file, include following code: .fieldWithErrors { padding: 2px; border: 2px solid red; display: table; } (in to *.css file) Andreas Schneider wrote:> well, I dont need to insert this > because I dont want a red border around my confirmation field - all the > time > only when an error occured > > > > Ilan Berci wrote: > > Andreas Schneider wrote: > >> > >> > >> do you think it is a css problem? I dont think so. > >> > > > > > > please insert the following into your .css file and refresh: > > > > #user_password_confirmation { > > border: 2px solid red > > } > > > > ilan > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
I''m having exactly the same problem The link to the stylesheet is the layouts *.rhtml file and this: .fieldWithErrors { padding: 2px; border: 2px solid red; display: table; } is included in the stylesheet But the borders around the fields with erros won''t go red --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider
2006-Nov-07 10:18 UTC
Re: Scaffold Password Confirmation => no red border
This is excactly what I hate on rails, all answers are different - and none of them is working. You cant solve the problem - because I tap into fog right now on a so easy thing that was done in asp in seconds. but with the scaffold thing - I dont know whats going on in the background. 1) yes, I use the scaffhold css 2) yes, I inserted <%= stylesheet_link_tag ''scaffold'', :media => ''all'' %> 3) the field that is not red - is a field that is not in the database - it is a password_confirmation field. the error text is correct and the confirmation works <%= password_field ''user'', ''password_confirmation'', { :maxlength => ''16'', :size => ''30'', :class => ''input'' } %> 4) my css class ''input'' is ok - i use it on all other fields too andreas -- 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 -~----------~----~----~----~------~----~------~--~---
On 7 November 2006 13:18, Andreas Schneider wrote:> This is excactly what I hate on rails, all answers are different - and > none of them is working. You cant solve the problem - because I tap into > fog right now on a so easy thing that was done in asp in seconds. but > with the scaffold thing - I dont know whats going on in the background. > > 1) yes, I use the scaffhold css > 2) yes, I inserted <%= stylesheet_link_tag ''scaffold'', :media => ''all'' > %> > 3) the field that is not red - is a field that is not in the database - > it is a password_confirmation field. the error text is correct and the > confirmation works > <%= password_field ''user'', ''password_confirmation'', { :maxlength => > ''16'', :size => ''30'', :class => ''input'' } %> > 4) my css class ''input'' is ok - i use it on all other fields tooYou see, it work like this: If you use built-in form helpers (e.g. text_field helper), they check if the model instance for which you render that field has errors, and if so, it will wrap the generated field HTML in DIV with some class (fieldWithErrors, but I''m not sure). Then, the validates_confirmation_of is designed to add validation error for the attribute itself, not it''s "_confirmation" brother (e.g. for "password", not for "password_confirmation"). So, when text_field for password_confirmation is produced, it find no errors for that field, so no "red border" is displayed around that field. The same problems I had long ago, when I designed validation for associated objects. E.g. Product should have a Category associated. I used to write class Product < ActiveRecord::Base belongs_to :category validates_presence_of :category end In the product edit I used to create a select for category_id attribute which didn''t outlined this select if there was no category specified. The right solution was to do "validates_presence_of :category_id" (and then, if you wish to, do "validates_associated :category"). Solutions are: 1. Leave everything as it is. Actually, It could be a problem with password field, not with password_confirmation field. 2. Design new validation that will check if attributes are equal and add error to password_confirmation instead of password. 3. Design a custom text_field helper for "password_confirmation", that will check if "password" field has errors and outline itself then. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---