Hi
I have a text_field as
<%= text_field :sd_resol, "hours", "size" => 2,
"value" => ''00'' %>
And on submit_to_remote :condition I am calling a script to check
whether hour contains only numeric data..How can I do it..I tried like
if(!isNumeric($F(''sd_resol_hours'') ))
But is not working..How can I do this?Please help
Sijo
--
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 1 Jul 2008, at 12:10, Sijo Kg wrote:> > Hi > I have a text_field as > <%= text_field :sd_resol, "hours", "size" => 2, "value" => ''00'' %> > And on submit_to_remote :condition I am calling a script to check > whether hour contains only numeric data..How can I do it..I tried like > > if(!isNumeric($F(''sd_resol_hours'') )) >condition needs to be a fragment of javascript which evaluates to true (or anything javascript will consider to be true) when the request should be made, ie :condition => "isNumeric($F(''sd_resol_hours''))" assuming you have a function called isNumeric that returns the appropriate value Fred> But is not working..How can I do this?Please help"it''s not working" is the single most unhelpful thing you can say when asking a question. Say what happens, what you expected to happen etc... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
O sorry I thought isNumeric is a function by javascript..So things not that much easy with javascript..I thought in the rails way that it will do some check using regex /(^\d+$)|(^\d+\.\d+$)/ ..So could you please tell me how can I do this? Sijo -- 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 -~----------~----~----~----~------~----~------~--~---
Are you trying to see if it''s an IP address?
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\. Should suffice.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Hi
I could solve it like
var anum=/(^\d+$)|(^\d+\.\d+$)/
hour=anum.test($F(''sd_resol_hours''))
minute=anum.test($F(''sd_resol_minutes''))
if (ho==false || min == false)
code here
Thanks for all the reply
Sijo
--
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
-~----------~----~----~----~------~----~------~--~---