the part/update method isn't typically used for rendering arbitrary
code. http://cookbook.hobocentral.net/manual/ajax#the_part_context

to do what you're after, you'd probably want something like this:

def update_result
  @result = 'some returned text'
end

<div part="update_result"><%= @result %></div>

on the first pass, @result is blank (or contains some other info).
when the form is submitted, the variable is set and the part mechanism
re-renders the part context with the new info.

if all you're after is updating like this without dryml or an active
record model(s) in the part, you can get same effect with regular
rails link_to_remote like you were describing.

On Aug 30, 2:52 pm, raygao <[email protected]> wrote:
> Kevin, thanks a lot for answering my question. :-)
>
> I am a little confused. I thought when I post the form, the controller
> will send back some result e.g.
> def update_result
>   render :text => 'some returned text'
> end
>
> And, the form will automatically, stuff that result into the div which
> is identified by <div par="updated_result>. But, nothing is not
> happening. It's my 1st try to use Ajax on Hobo. So, I am a bit
> perplexed by not seeing any result. Can you please correct my error
> and perhaps show an example please?
>
> Thanks a million,
>
> -Ray
>
> On Aug 30, 1:46 pm, kevinpfromnm <[email protected]> wrote:
>
> > what is in the result part?  ajax updates save the part context and
> > use the update to post back the updated context.
>
> > so, if <div part="update_result">just this text</div> then since
> > there's no object dependence there, the update will just post the same
> > text.  now, I'm not sure if there's a method built in that allows for
> > updating a part with arbitrary content with it, but from what I've
> > found there is not.
>
> > oh, also, if you specify the action, the form becomes a regular form
> > but that might not be effecting this.
>
> > On Aug 29, 12:43 am, raygao <[email protected]> wrote:
>
> > > Hi,
>
> > > I am trying to use the Hobo's Ajax Form. But, it is not working. I am
> > > on hobo 1.0.1
>
> > > I have the following:
> > > <form with="&MyObjectList.new" update="update_result"
> > > action="update_func">
> > > <select>
> > > <option value="1">One</option>
> > > <option value="2">Two</option>
> > > </select>
> > > <submit_tag label="save"/>
> > > </form>
>
> > > <div part="update_result" id="update_result">some temporary stuff</
> > > div>
>
> > > I can see it through debugging that it does reach "update_func" and a
> > > response is sent back. But, the div never gets updated. As I am not
> > > familiar with the inner working of the <form> tag in Hobo, I don't
> > > know how to fix it.
>
> > > Can someone please help me? I have already spend 2 days trying this.
> > > So, far I can get link_to_remote to do ajax update. But, the hobo form
> > > ajax feature is not working.
>
> > > Any input will be highly appreciated.
>
> > > Thanks,
>
> > > -Ray

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to