Leonardo Mateo wrote: > On Tue, Oct 20, 2009 at 3:40 AM, Francesco Belladonna > <[email protected]> wrote: >> I would like to use only one field (always) (will be something that I'll >> use for all :date field-type), a text field, where the date will be >> written in dd/mm/YY format, how can I do this without writing something >> in javascript that "set some hidden fields" (month and year) when you >> write in the text field? > How would you do that on PHP? > >> >> Are there a "general" way (as I've said, I'll use this always instead of >> normal way of setting dates)? > > Scaffold will generate the form, but you can modify it as you please. > Change the form and make sure the parameters are OK in the controller > (yes, with tests) > > Hope it helps. > > -- > Leonardo Mateo. > There's no place like ~ In PHP I don't have a predefined framework and so I don't have rules to follow (but this is not a good thing: I'm changing from PHP to Ruby also for this reason), I have to write my own form and rewrite the way I use it for storing informations
BTW, I'm quite sure that I'm not explaining very well but I've found something: In ActionView::Helpers::DateHelper there is "date_select" method, which creates html tags formatted in a way, so the day selection tag will have "name" attribute "calendar[mydate(3i)]", the month will have "calendar[mydate(2i)]" and so on. If I change these tags in my single text field tag I will have "calendar[mydate]" and nothing else, but when I send this information obviusly ruby should understand how to "split" this date to store it: where should I do this (and where could I read my submitted vars?)? In controller I only have Calendar.new(params[:calendar]) in create method, so I think that params should be "changed" in some way, is this the good way? -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

