Sunday, January 16, 2011

Re: [Rails] Re: text box value in the confirmation popup

On Jan 16, 2011, at 7:23 PM, Me wrote:

> Ok I am doing it the manual way, how do I get the value to show up?
> Are the quotes correct?
>
> <input id="funding_transaction_submit" name="commit" onclick="if (!
> confirm('Are you sure you would like ' + $
> ('funding_transaction_deposit') + ' dibits deposited?') return
> false; return true;" type="submit" />

The simplest way to do the return true/false stuff is:

<form action="foo" method="post" onsubmit="return confirm('Are you
sure?');">
...

The return false (which happens if the confirm is cancelled) stops the
form submission directly. I imagine you could do the same with your
onclick event on the button, but putting it in the form submission
makes it pretty foolproof, since the button might not be clicked
(someone types Enter and the form submits without a click).

Walter


--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate