On Jul 1, 2011, at 9:13 AM, Rodrigo Ruiz wrote:
> Can't I do that only with ruby and rails?
>
> On Fri, Jul 1, 2011 at 3:25 AM, Leoncio Caminha <leoncio.sobreira@gmail.com
> > wrote:
> make on javascript for that and call in :onkeypress =>
> 'yourJS(this);' i think so
> Em 30/06/2011, às 22:23, Rodrigo Ruiz escreveu:
You could certainly clean up any user input in a before_validation
filter method. I don't know how you would figure out which mask to
use, but what I usually do is first strip out anything that isn't a
numeral, and then take the numbers back through a mask so that first n
numbers are area code, next are exchange, then station, then extension
if anything is left over. If you had multiple nations or any optional
elements (country code) then the problem gets a lot harder to solve.
By the way, as Leoncio pointed out, this could all be done in
JavaScript, and the implementation is largely the same; string
operations being more or less identical (and with Prototype.js, even
having the same names for the functions) in either JavaScript or Ruby.
Walter
>
> > Well, that's basically it, how can I make an input field for date
> like mm/dd/yyyy and for telephone like +xx (xx) xxxx-xxxx.
> >
> > Thank you,
> > Rodrigo
> >
> > --
> > 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@googlegroups.com
> .
> > 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
> .
>
> --
> 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@googlegroups.com.
> 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
> .
>
>
>
> --
> 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@googlegroups.com.
> 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
> .
--
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@googlegroups.com.
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.
No comments:
Post a Comment