I''ve googled around for a solution for this, but no luck. I have a simple form. It submits to a controller. The controller action passes through to an .rjs template. The page is updated and all is well. I wanted to disable the button because people were double submitting, so I used: :disable_with => ''Adding'' The button is disabled when I click on it. However, my rjs now comes back as text and is rendered in the browser instead of being rendered as page updates. Content-Type: text/javascript; is correct, so the .rjs is being picked up fine. Any ideas on what to check next? I''m using Mongrel 1.0.1 with rails 1.2.3 (same error on 1.1.6, too). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It may be because I''m not very clever, but to get to the same result,
I''ve always coded something like this:
<span id="submit">
<%= submit_tag "submit"
:onclick="$(''submit'').hide()" %>
</span>
It''s not nearly as terse as your code, but it gets the job done and
may solve your issue. When I was getting the results you described, it
was because I had forgotted to add the
javascript_include_tag :defaults to my layout.
good luck,
Bryce
On Mar 14, 7:48 am, "wesgarrison"
<wes.garri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''ve googled around for a solution for this, but no luck.
>
> I have a simple form. It submits to a controller. The controller
> action passes through to an .rjs template. The page is updated and
> all is well.
>
> I wanted to disable the button because people were double submitting,
> so I used:
> :disable_with => ''Adding''
>
> The button is disabled when I click on it.
>
> However, my rjs now comes back as text and is rendered in the browser
> instead of being rendered as page updates.
> Content-Type: text/javascript; is correct, so the .rjs is being picked
> up fine.
>
> Any ideas on what to check next? I''m using Mongrel 1.0.1 with
rails
> 1.2.3 (same error on 1.1.6, too).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Bryce:
Your solution works great! Thanks for the pointer.
For posterity, I actually used this:
<%= submit_tag "Add Comment", :class =>
''submit'', :id =>
''submit_button'', :onclick =>
"$(''submit_button'').hide()" %>
The key thing being "id" and $(...) have to match.
-- Wes
On Mar 14, 10:18 am, "Bryce"
<brycebryceb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> It may be because I''m not very clever, but to get to the same
result,
> I''ve always coded something like this:
>
> <span id="submit">
> <%= submit_tag "submit"
:onclick="$(''submit'').hide()" %>
> </span>
>
> It''s not nearly as terse as your code, but it gets the job done
and
> may solve your issue. When I was getting the results you described, it
> was because I had forgotted to add the
> javascript_include_tag :defaults to my layout.
>
> good luck,
> Bryce
>
> On Mar 14, 7:48 am, "wesgarrison"
<wes.garri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > I''ve googled around for a solution for this, but no luck.
>
> > I have a simple form. It submits to a controller. The controller
> > action passes through to an .rjs template. The page is updated and
> > all is well.
>
> > I wanted to disable the button because people were double submitting,
> > so I used:
> > :disable_with => ''Adding''
>
> > The button is disabled when I click on it.
>
> > However, my rjs now comes back as text and is rendered in the browser
> > instead of being rendered as page updates.
> > Content-Type: text/javascript; is correct, so the .rjs is being picked
> > up fine.
>
> > Any ideas on what to check next? I''m using Mongrel 1.0.1
with rails
> > 1.2.3 (same error on 1.1.6, too).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Glad that worked out for you. I had tried the :id => ''something'' without a lot of success in the past. I guess I should give it another go. You don''t know anything about rake tasks do you? http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/68f64e3baaf43df3 On Mar 14, 8:47 am, "wesgarrison" <wes.garri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Bryce: > Your solution works great! Thanks for the pointer. > > For posterity, I actually used this: > <%= submit_tag "Add Comment", :class => ''submit'', :id => > ''submit_button'', :onclick => "$(''submit_button'').hide()" %> > > The key thing being "id" and $(...) have to match. > > -- Wes > > On Mar 14, 10:18 am, "Bryce" <brycebryceb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > It may be because I''m not very clever, but to get to the same result, > > I''ve always coded something like this: > > > <span id="submit"> > > <%= submit_tag "submit" :onclick="$(''submit'').hide()" %> > > </span> > > > It''s not nearly as terse as your code, but it gets the job done and > > may solve your issue. When I was getting the results you described, it > > was because I had forgotted to add the > > javascript_include_tag :defaults to my layout. > > > good luck, > > Bryce > > > On Mar 14, 7:48 am, "wesgarrison" <wes.garri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''ve googled around for a solution for this, but no luck. > > > > I have a simple form. It submits to a controller. The controller > > > action passes through to an .rjs template. The page is updated and > > > all is well. > > > > I wanted to disable the button because people were double submitting, > > > so I used: > > > :disable_with => ''Adding'' > > > > The button is disabled when I click on it. > > > > However, my rjs now comes back as text and is rendered in the browser > > > instead of being rendered as page updates. > > > Content-Type: text/javascript; is correct, so the .rjs is being picked > > > up fine. > > > > Any ideas on what to check next? I''m using Mongrel 1.0.1 with rails > > > 1.2.3 (same error on 1.1.6, too).--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---