xxdesmus
2010-Mar-05 15:27 UTC
How to change a text field''s contents to all uppercase letter
Hi, I''m relatively new to RoR so pardon if this is a really stupid question. I have a text field where people will be entering a username. I need to figure out a way to either 1. validate the field so that it will not be accepted unless they''ve entered all uppercase letters for their username -- less ideal 2. regardless of what they enter in the field (uppercase or lowercase) I need to convert the username value to uppercase before it''s stored in the database. Here is my form: <% form_for(@post) do |f| %> <%= f.error_messages %> <fieldset> <legend>Enter Details</legend> <div> <%= f.label :username,''Enter your username:'' %> <%= f.text_field :username, :size => 40 %> </div> <div> <%= f.submit "Save", :class => "submit" %> </div> </fieldset> <% end %> Thanks so much for any assistance! I greatly appreciate any help. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Andy Jeffries
2010-Mar-05 16:05 UTC
Re: How to change a text field''s contents to all uppercase letter
> > 2. regardless of what they enter in the field (uppercase or lowercase) > I need to convert the username value to uppercase before it''s stored >Try this: class Post < ActiveRecord::Base def before_save self.username.downcase! end end Cheers, Andy -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-05 16:07 UTC
Re: How to change a text field''s contents to all uppercase letter
did you mean: self.username.upcase ?? .... I need to make sure the username is uppercase, not lowercase. Thanks so much for the quick reply! On Mar 5, 11:05 am, Andy Jeffries <andyjeffr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 2. regardless of what they enter in the field (uppercase or lowercase) > > I need to convert the username value to uppercase before it''s stored > > Try this: > > class Post < ActiveRecord::Base > def before_save > self.username.downcase! > end > end > > Cheers, > > Andy-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 16:12 UTC
Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:05, Andy Jeffries <andyjeffries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:>> 2. regardless of what they enter in the field (uppercase or lowercase) >> I need to convert the username value to uppercase before it''s stored > > self.username.downcase!erm... upcase! ;-) Or change the setter (rather than messing around with filters ;-) def username=(value) write_attribute(:username, value.upcase) end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Andy Jeffries
2010-Mar-05 16:17 UTC
Re: How to change a text field''s contents to all uppercase letter
> > >> 2. regardless of what they enter in the field (uppercase or lowercase) > >> I need to convert the username value to uppercase before it''s stored > > > > self.username.downcase! > > erm... upcase! ;-) >Doh :-)> Or change the setter (rather than messing around with filters ;-) > > def username=(value) > write_attribute(:username, value.upcase) > end >Is the setter called if you assign to the attributes hash (e.g. with new or create)? I guess it must be, but I''d generally put that in a callback to be sure :-) Cheers, Andy -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-05 16:24 UTC
Re: How to change a text field''s contents to all uppercase letter
I''d be putting this: def username=(value) write_attribute(:username, value.upcase) end in my controller right? Sorry for the beginning questions... On Mar 5, 11:12 am, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5 March 2010 16:05, Andy Jeffries <andyjeffr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> 2. regardless of what they enter in the field (uppercase or lowercase) > >> I need to convert the username value to uppercase before it''s stored > > > self.username.downcase! > > erm... upcase! ;-) > > Or change the setter (rather than messing around with filters ;-) > > def username=(value) > write_attribute(:username, value.upcase) > end-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 16:25 UTC
Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:17, Andy Jeffries <andyjeffries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:>> Or change the setter (rather than messing around with filters ;-) >> >> def username=(value) >> write_attribute(:username, value.upcase) >> end > > Is the setter called if you assign to the attributes hash (e.g. with new or > create)? > I guess it must be, but I''d generally put that in a callback to be sure :-) > Cheers, >ooo.... good question - don''t know without testing it...>> User.new(:username => "fred")=> #<User id: nil, role_detail_id: nil, title: "FRED", first_name: nil, last_name: nil> yup, looks that way. But more to the point, I don''t like changing users'' input before storing it in the DB. We''ve shown how you *can* do it, and you''ve said you *need* to, but I''d wonder whether that''s really a *want* to... either way... it works either way. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 16:25 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:24, xxdesmus <xxdesmus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''d be putting this: > > def username=(value) > write_attribute(:username, value.upcase) > end > > in my controller right? Sorry for the beginning questions... >nope - in the User model. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-05 16:38 UTC
Re: How to change a text field''s contents to all uppercase letter
Worked perfectly...thanks so much! Hey, you don''t happen to know of a simple way of implementing a date picker for a field in a form do you? I was hoping to accomplish this without needing to track down a plugin for the task. On a related note: how can I set the default value of a field to be today''s date (just the date, no time value) Thanks for all the help! On Mar 5, 11:25 am, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5 March 2010 16:24, xxdesmus <xxdes...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''d be putting this: > > > def username=(value) > > write_attribute(:username, value.upcase) > > end > > > in my controller right? Sorry for the beginning questions... > > nope - in the User model.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 16:43 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:38, xxdesmus <xxdesmus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, you don''t happen to know of a simple way of implementing a date > picker for a field in a form do you? I was hoping to accomplish this > without needing to track down a plugin for the task.I''ve used the "calendar_date_select" plugin in the past - it is a plugin, but it''s also very simple.> On a related note: how can I set the default value of a field to be > today''s date (just the date, no time value)Again in the model (one of several ways to address the need) : def after_initialize my_date_field = Date.today end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 16:51 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:43, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Again in the model (one of several ways to address the need) : > > def after_initialize > my_date_field = Date.today > end >Sorry - that''s bad - it will always reset the value to today even if there is an existing value... This will just set it if the "my_date_field" value is nil: my_date_field ||= Date.today -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-05 16:52 UTC
Re: How to change a text field''s contents to all uppercase letter
When I add this to my model: def after_initialize :date = Date.today end I get this error -- /home/xxdesmus/timetool/app/models/post.rb:38: syntax error, unexpected ''='', expecting kEND :date = Date.today ^ when I try it this way: def after_initialize date = Date.today end It doesn''t do anything ...probably because my field should have a different name other than "date" huh? On Mar 5, 11:43 am, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5 March 2010 16:38, xxdesmus <xxdes...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey, you don''t happen to know of a simple way of implementing a date > > picker for a field in a form do you? I was hoping to accomplish this > > without needing to track down a plugin for the task. > > I''ve used the "calendar_date_select" plugin in the past - it is a > plugin, but it''s also very simple. > > > On a related note: how can I set the default value of a field to be > > today''s date (just the date, no time value) > > Again in the model (one of several ways to address the need) : > > def after_initialize > my_date_field = Date.today > end-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Andy Jeffries
2010-Mar-05 16:55 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
> > When I add this to my model: > > def after_initialize > :date = Date.today > end > > I get this error -- /home/xxdesmus/timetool/app/models/post.rb:38: > syntax error, unexpected ''='', expecting kEND :date = Date.today ^ >You will do, you''re trying to assign a value to a symbol (which is an immutable object).> when I try it this way: > > def after_initialize > date = Date.today > end > > It doesn''t do anything ...probably because my field should have a > different name other than "date" huh? >def after_initialize self.date = Date.today end Doing: date Will just assign the value to a local variable. Cheers, Andy -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 16:57 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:55, Andy Jeffries <andyjeffries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> def after_initialize > self.date = Date.today > end > > Doing: > date > Will just assign the value to a local variable.+1 pesky local variables... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 17:00 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 16:52, xxdesmus <xxdesmus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When I add this to my model: > > def after_initialize > :date = Date.today > endAs an aside, using "date" as a name for a db field might cause you confusion down the line - it can be a reserved word (depending on the db). I''d try to give the some more name context: "registration_date" or whatever. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-05 17:02 UTC
Re: How to change a text field''s contents to all uppercase letter
Got it working with: def after_initialize self.date ||= Date.today end ...hopefully I won''t be pressing my luck, but one last question (for now). So I have a bunch of form fields that I need to add up their values, and make sure their sum does not except the value entered in a new form field. If the sum does exceed the form field value then I want to alert the user and prevent it from saving. Basically I want to validate that :atWorkHours.value > ( :hoursMeetings.value + :hoursTraining.value + :hoursProjTrav.value ) I tried to do something similar to this in my model...but I assume I just had the syntax completely wrong. Last question/request for the day I promise! Thanks, Justin :) On Mar 5, 11:55 am, Andy Jeffries <andyjeffr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > When I add this to my model: > > > def after_initialize > > :date = Date.today > > end > > > I get this error -- /home/xxdesmus/timetool/app/models/post.rb:38: > > syntax error, unexpected ''='', expecting kEND :date = Date.today ^ > > You will do, you''re trying to assign a value to a symbol (which is an > immutable object). > > > when I try it this way: > > > def after_initialize > > date = Date.today > > end > > > It doesn''t do anything ...probably because my field should have a > > different name other than "date" huh? > > def after_initialize > self.date = Date.today > end > > Doing: > > date > > Will just assign the value to a local variable. > > Cheers, > > Andy-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-05 19:44 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 5 March 2010 17:02, xxdesmus <xxdesmus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> So I have a bunch of form fields that I need to add up their > values, and make sure their sum does not except the value entered in a > new form field. If the sum does exceed the form field value then I > want to alert the user and prevent it from saving. Basically I want to > validate that :atWorkHours.value > ( :hoursMeetings.value > + :hoursTraining.value + :hoursProjTrav.value ) > > I tried to do something similar to this in my model...but I assume I > just had the syntax completely wrong.Assuming all of the "hours" attributes all return numbers (something, somewhere is ensuring that, I hope ;-) -- you can add some validations to your model. Again, there''s a couple of ways of doing this - I normally separate the method that adds the error to base from the code that checks the condition (so I can check the condition myself if I want), but you could easily merge them together if you prefer: validate :validate_work_hours_not_exceeded def work_hours_exceeded? # this is a little different to your equation, as yours would raise an error if both sides were exactly the same, and I''d guess that''s not the right result - but if not, adjust it to suit [hours_at_meetings, hours_in_training, hours_travelling].sum > hours_at_work end private def validate_work_hours_not_exceeded errors.add_to_base("Do not exceed working hours") if work_hours_exceeded? end I took the liberty of tweaking the variable names (although you were showing them as symbols...) to make them a little more in line with conventions (and, I think, more easily readable - YMMV :-) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-07 13:45 UTC
Re: How to change a text field''s contents to all uppercase letter
Thank you so much for all your help! On Mar 5, 2:44 pm, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5 March 2010 17:02, xxdesmus <xxdes...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > So I have a bunch of form fields that I need to add up their > > values, and make sure their sum does not except the value entered in a > > new form field. If the sum does exceed the form field value then I > > want to alert the user and prevent it from saving. Basically I want to > > validate that :atWorkHours.value > ( :hoursMeetings.value > > + :hoursTraining.value + :hoursProjTrav.value ) > > > I tried to do something similar to this in my model...but I assume I > > just had the syntax completely wrong. > > Assuming all of the "hours" attributes all return numbers (something, > somewhere is ensuring that, I hope ;-) -- you can add some > validations to your model. Again, there''s a couple of ways of doing > this - I normally separate the method that adds the error to base from > the code that checks the condition (so I can check the condition > myself if I want), but you could easily merge them together if you > prefer: > > validate :validate_work_hours_not_exceeded > > def work_hours_exceeded? > # this is a little different to your equation, as yours would > raise an error if both sides were exactly the same, and I''d guess > that''s not the right result - but if not, adjust it to suit > [hours_at_meetings, hours_in_training, hours_travelling].sum > > hours_at_work > end > > private > def validate_work_hours_not_exceeded > errors.add_to_base("Do not exceed working hours") if work_hours_exceeded? > end > > I took the liberty of tweaking the variable names (although you were > showing them as symbols...) to make them a little more in line with > conventions (and, I think, more easily readable - YMMV :-)-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-07 14:16 UTC
Re: How to change a text field''s contents to all uppercase letter
Not having any luck with Calendar Date Select so far ... got it installed, but it looks like the documentation is out of date @ http://www.railslodge.com/plugins/46-calendar-date-select ...I can''t for the life of me get the pop-up or embedded calendar to display ...let alone get either to display in a form to take a value. On Mar 7, 8:45 am, xxdesmus <xxdes...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you so much for all your help! > > On Mar 5, 2:44 pm, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On 5 March 2010 17:02, xxdesmus <xxdes...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > So I have a bunch of form fields that I need to add up their > > > values, and make sure their sum does not except the value entered in a > > > new form field. If the sum does exceed the form field value then I > > > want to alert the user and prevent it from saving. Basically I want to > > > validate that :atWorkHours.value > ( :hoursMeetings.value > > > + :hoursTraining.value + :hoursProjTrav.value ) > > > > I tried to do something similar to this in my model...but I assume I > > > just had the syntax completely wrong. > > > Assuming all of the "hours" attributes all return numbers (something, > > somewhere is ensuring that, I hope ;-) -- you can add some > > validations to your model. Again, there''s a couple of ways of doing > > this - I normally separate the method that adds the error to base from > > the code that checks the condition (so I can check the condition > > myself if I want), but you could easily merge them together if you > > prefer: > > > validate :validate_work_hours_not_exceeded > > > def work_hours_exceeded? > > # this is a little different to your equation, as yours would > > raise an error if both sides were exactly the same, and I''d guess > > that''s not the right result - but if not, adjust it to suit > > [hours_at_meetings, hours_in_training, hours_travelling].sum > > > hours_at_work > > end > > > private > > def validate_work_hours_not_exceeded > > errors.add_to_base("Do not exceed working hours") if work_hours_exceeded? > > end > > > I took the liberty of tweaking the variable names (although you were > > showing them as symbols...) to make them a little more in line with > > conventions (and, I think, more easily readable - YMMV :-)-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Viorel
2010-Mar-07 20:01 UTC
Re: How to change a text field''s contents to all uppercase letter
> Hey, you don''t happen to know of a simple way of implementing a date > picker for a field in a form do you? I was hoping to accomplish this > without needing to track down a plugin for the task. > > On a related note: how can I set the default value of a field to be > today''s date (just the date, no time value)Did you try date_select? <%=f.date_select :name_of_field %> It defaults to today date if the field is of type date It is not too fancy, but it works... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
xxdesmus
2010-Mar-08 02:29 UTC
Re: How to change a text field''s contents to all uppercase letter
I tried date_select but I kept getting a bunch of errors. On Mar 7, 3:01 pm, Viorel <viorelvl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hey, you don''t happen to know of a simple way of implementing a date > > picker for a field in a form do you? I was hoping to accomplish this > > without needing to track down a plugin for the task. > > > On a related note: how can I set the default value of a field to be > > today''s date (just the date, no time value) > > Did you try date_select? > <%=f.date_select :name_of_field %> > It defaults to today date if the field is of type date > It is not too fancy, but it works...-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Mar-08 14:33 UTC
Re: Re: How to change a text field''s contents to all uppercase letter
On 7 March 2010 14:16, xxdesmus <xxdesmus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Not having any luck with Calendar Date Select so far ... got it > installed, but it looks like the documentation is out of date @ > http://www.railslodge.com/plugins/46-calendar-date-select ...I can''t > for the life of me get the pop-up or embedded calendar to > display ...let alone get either to display in a form to take a value. >This is the location I''ve gotten it from in the past: http://electronicholas.com/calendar -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Viorel
2010-Mar-08 20:44 UTC
Re: How to change a text field''s contents to all uppercase letter
What errors? On Mar 8, 4:29 am, xxdesmus <xxdes...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I tried date_select but I kept getting a bunch of errors. > > On Mar 7, 3:01 pm, Viorel <viorelvl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hey, you don''t happen to know of a simple way of implementing a date > > > picker for a field in a form do you? I was hoping to accomplish this > > > without needing to track down a plugin for the task. > > > > On a related note: how can I set the default value of a field to be > > > today''s date (just the date, no time value) > > > Did you try date_select? > > <%=f.date_select :name_of_field %> > > It defaults to today date if the field is of type date > > It is not too fancy, but it works...-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.