Hi,
I am trying to implement wizard for my application. I am doing it with
hidden divs.
For navigation purposes: I am using hidden input fields such as:
<input id="wizard_current_state" name="state"
type="hidden" value = 1 />
<input id="wizard_previous_state" name="state"
type="hidden" value = 1
/>
So that when someone presses next, i can increment the current_state to
2 in JavaScript Function that i have written.
$(''wizard_previous_state'').value = previous
$(''wizard_current_state'').value
current = $(''wizard_current_state'').value = previous + 1
But "previous + 1 " is evaluated as 1 + 1 = 11 (string concat).
How do i say that i want hidden value to be integer?
Any suggestions?
Regards,
Sandeep G
-- 
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/27/08, Sandeep Gudibanda <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I am trying to implement wizard for my application. I am doing it with > hidden divs. > For navigation purposes: I am using hidden input fields such as: > <input id="wizard_current_state" name="state" type="hidden" value = 1 /> > <input id="wizard_previous_state" name="state" type="hidden" value = 1 > /> > > So that when someone presses next, i can increment the current_state to > 2 in JavaScript Function that i have written. > > $(''wizard_previous_state'').value = previous > $(''wizard_current_state'').value > current = $(''wizard_current_state'').value = previous + 1 > > But "previous + 1 " is evaluated as 1 + 1 = 11 (string concat). > > How do i say that i want hidden value to be integer?I''m pretty sure that the values of fields are always strings. But you should be able to do what you want with something like current = $(wizard_current_state).value = +previous + 1 In Javascript, using a unary + operator on a string containing a number will produce the number. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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 -~----------~----~----~----~------~----~------~--~---
Sandeep Gudibanda
2008-Jan-27  17:08 UTC
Re: hidden inputs fields are always strings(chars)?
Thanks Rick. That helps. -- 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 -~----------~----~----~----~------~----~------~--~---