First of all you should make sure you''re replying to the list and not
to the
person who posted.
As for making the confirm conditional, you need to generate the options hash
before it''s used. e.g.:
<%= form_remote_tag(:url => {:action =>
''save_query''},
:confirm => ''Are you sure you want to overwrite
this?'',
:html => {:id => ''save_query_form''})
%>
Becomes
<% options = { :url => {:action => ''save_query''},
:html => {:id =>
''save_query_form''} } %>
<% options[:confirm] = "Are you sure..." if some_condition_here
%>
<%= form_remote_tag( options ) %>
Jason
On 9/19/06, Jackdan <jd.beaubien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Eumh, yes I easily have access to the list of existing queries when the
> page loads...but I have absolutely no clue how to make the confirm
> conditional. Is itreally possible? Can you tell me how?
>
> For nwo my form_remote_tag looks like this:
> <%= form_remote_tag(:url => {:action =>
''save_query''},
> :confirm => ''Are you sure you want to
overwrite
> this?'',
> :html => {:id =>
''save_query_form''}) %>
>
> How do you make the confirm conditional?
>
> Thank you,
>
> Jd
>
> Jason Roelofs wrote:
> > Do the pop-up before the Ajax post
> >
> > :confirm => ''Are you sure you want to save this?''
> >
> > I''m assuming that you can easily check for existing queries
when this
> page
> > loads and make the confirm conditional.
> >
> > Jason
> >
> > On 9/19/06, Jackdan
<jd.beaubien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > >
> > >
> > > Hi everyone,
> > >
> > > In my app users can save queries. I want to warn them if they
are
> > > about to overwrite an existing query (same name). I wanted to do
this
> > > with a confirm javascript popup.
> > >
> > > My question is: Is it possible to generate a confirmation popup
from
> > > an RJS template and then somehow get the answer back? To know if
my
> > > controller should overwrite the query or just discard the
changes.
> > >
> > > Up until now, I didn''t find a way to generate a
confirmation popup
> > > through RJS, except with the call method to call a javascript
method
> > > that will generate this for me...but I was hoping for something a
bit
> > > more ruby...and it doesn''t solve the problem of getting
the answer
> back
> > > to the controller.
> > >
> > > Thank you,
> > >
> > > Jd
> > >
> > >
> > > >
> > >
> >
> > ------=_Part_6879_28764909.1158669509657
> > Content-Type: text/html; charset=ISO-8859-1
> > X-Google-AttachSize: 1355
> >
> > Do the pop-up before the Ajax post<br><br>:confirm
=> ''Are you sure
> you want to save this?''<br><br>I''m assuming
that you can easily check for
> existing queries when this page loads and make the confirm
> conditional.<br><br>
> > Jason<br><br><div><span
class="gmail_quote">On 9/19/06, <b
> class="gmail_sendername">Jackdan</b> <<a
href="mailto:
>
jd.beaubien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org">jd.beaubien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org</a>>
> wrote:</span><blockquote class="gmail_quote"
style="border-left: 1px solid
> rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> > <br>Hi everyone,<br><br>In my app users can save
queries. I
> want to warn them if they are<br>about to overwrite an existing query
(same
> name). I wanted to do this<br>with a confirm
javascript
> popup.<br><br>My question is: Is it possible
to generate a
> confirmation popup from
> > <br>an RJS template and then somehow get the answer
back? To
> know if my<br>controller should overwrite the query or just discard
the
> changes.<br><br>Up until now, I didn''t find a way to
generate a confirmation
> popup<br>through RJS, except with the call method to call a
javascript
> method
> > <br>that will generate this for me...but I was hoping for
something a
> bit<br>more ruby...and it doesn''t solve the problem of
getting the answer
> back<br>to the controller.<br><br>Thank
you,<br><br>Jd<br><br><br>
> > ------=_Part_6879_28764909.1158669509657--
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---