Hi Jason,

You can do this with RJS. With the form you can post through the object and
evaluate it in the action, and in the RJS template, you can do your:

page.hide and page.show

http://www.railsmanual.org/class/ActionView%3A%3AHelpers%3A%3APrototypeHelpe
r%3A%3AJavaScriptGenerator#hide

I have written a very basic outline of the methods which can be used in RJS.
You can render the template the same as a .rhtml doc, simply name it to
.rjs. 

http://www.nshb.net/rjs-templates-simplified.html

For example:

With a file.. /app/views/layouts/magic.rjs

You can render it like so within the controller/action that the
form_remote_tag points to.. render :partial => 'layouts/magic'

Within that RJS template, or within the controller action itself, you can
evaluate all the Ruby you like.

-Nb

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Nathaniel S. H. Brown                           http://nshb.net 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jason LaPier
> Sent: February 27, 2006 11:51 AM
> To: [email protected]
> Subject: [PDX.rb] Rails/ajax question - conditional for :completed ?
> 
> I have a form_remote_tag that updates one div block, but I 
> want it to unhide or hide another div block based on a 
> boolean setting on an object. Since the :completed and 
> :success fields only take javascript, how can I get the 
> javascript to evaluate a rails-object attribute? I'm trying 
> to find an example and I'm wondering if I should use 
> evaluate_remote_response or something like that, but I can't 
> figure out how that function works.
> 
> Anyone got any hints or can point me in the right direction?
> 
> Thanks!
> 
> 
> Jason LaPier
> Network Manager
> TACS / WRRC
> University of Oregon
> 
> _______________________________________________
> PDXRuby mailing list
> [email protected]
> IRC: #pdx.rb on irc.freenode.net
> http://lists.pdxruby.org/mailman/listinfo/pdxruby
> 

_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby

Reply via email to