Well, why not try observe_field? like this i did
<%= check_box :campaign, :use_global, {}, 1,0 %>
<%= observe_field :campaign_use_global, :url => {:controller =>
"metakeys",:action => 'update_metakeys_flag', :id => parent_id, :type =>
"campaign"}, :with => "'val='+value", :method => :post %>
Thanks
On Wed, Aug 18, 2010 at 2:34 PM, AppleII717 <[email protected]> wrote:
> The rails.js UJS file appears to handle only links/anchors or forms.
>
> I went through a "I want to do this with UJS" about a week ago. While
> I got it to work, I am not sure what I accomplished since I was not
> doing AJAX - I just wanted to replace a non-working client-side
> Javascript validation routine.
>
> My journey is detailed in a post: <http://groups.google.com/group/
> rubyonrails-talk/browse_thread/thread/0e4cf37dbfab4d94?hl=en#<http://groups.google.com/group/%0Arubyonrails-talk/browse_thread/thread/0e4cf37dbfab4d94?hl=en#>
> >
>
> I've had limited response on rails3 questions since probably less that
> 10% of those on the list are currently trying it. I did do some
> experimenting with what I think you are trying to do. One approach is
> to wrap your checkbox in a link:
>
> <%=link_to( check_box_tag( "selection", "1", false, {:id =>
> user.id}) , "/yoururl/1", :remote => true) %> One
>
> In tracing the javascript it will do a GET request to /yoururl/1
>
> if you do:
>
> <%=link_to( check_box_tag( "selection", "1", false, {:id =>
> user.id}), "/yoururl/1", :remote => true, :"data-method" =>
> "showHideMenuItem") %> One
>
> That will try a POST request to /yoururl/1
>
>
> If you do "
>
> <%=link_to( check_box_tag( "selection", "1", false, {:id =>
> user.id}), "/yoururl/1" :"data-method" => "showHideMenuItem") %> One
>
> That will act like the delete action and build a form and submit try
> to submit it.
>
> Somewhere in there you have to deal with the checkbox. I've never
> experimented with a xxx.js.erb file, so I guess you do it there.
>
> Hope this gives you a start.
>
>
> On Aug 17, 11:52 am, Erwin <[email protected]> wrote:
> > I have current a js function call I would like to transform into an
> > Ajax request
> >
> > = check_box_tag "selection", "1", false, {:id => user.id,
> :onclick =>
> > "showHideMenuItem(this);"}
> >
> > I found a lot of examples on link_to , but none on a checkbox .. I
> > know I have to add :remote => true somewhere, but that's all I
> > know ..
> >
> > please, any help or tip will be welcome !
> >
> > thanks a lot for your links...
> >
> > erwin
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.