Your controller action needs part support.   It's baked into the
standard Hobo actions, but if you're using a Rails action, you need to
add it yourself.

def my_action
  if request.xhr? && params[:render]
    hobo_ajax_response
  else
    render whatever
  end
end

Bryan


On Sun, Feb 3, 2013 at 5:55 PM, Alex Greif <[email protected]> wrote:
> Hi Bryan,
>
> All what I want to do is to have a button, that makes a simple ajax call
> and replaces the content of a div wi a simple text, nothing more.
> I think I completely misunderstand something with this parts concept, but
> I cannot figure it out.
>
>
> I have a very simple hobo model with the generated controller.
> I added only one method to the controller:
>
>   def do_something
>     render :text => "test"
>   end
>
> here is an excerpt of my (not working) show.dryml with this error:
> error:
> invalid part="my_id" attribute on <div>
>
> <show-page>
>   <append-content-body:>
>      <div part="my_id">N/A</div>
>      <form with="&this" action="do_something" update="my_id"><submit
> label="Do Something"/></form>
>   </append-content-body:>
> </show-page>
>
>
> I had to remove the part concept totally, because it did not work.
> Even <part name="...."> throw an exception, that part is not a method
>
> here is my new version:
>
> <show-page>
>   <append-content-body:>
>      <div part="my_id">N/A</div>
>     <form action="&do_something_path(this)" updates="#my_id"><submit
> label="Do Something"/></form>
>     Name: <div id="myname">N/A</div>
>   </append-content-body:>
> </show-page>
>
> this uses routes:
>   match 'mymodel/:id/do_something' => 'mymodel#do_something', :as =>
> 'do_something'
>
> and the controller does:
>
>   def do_something
>     render :text => "$('#my_id').html('...')"
>   end
>
>
> Alex.
>
>
>
>> Hi Alex,
>>
>> That sort of structure is used very commonly in Hobo apps.   Just to
>> test, I modified one of my apps to use a structure closer to what you
>> described, and it works fine.   I'm going to need more information to
>> help you track your problem down.
>>
>> Bryan
>>
>>
>> On Sun, Feb 3, 2013 at 10:43 AM, Alex Greif <[email protected]> wrote:
>>> Hi,
>>>
>>> i have got a problem with a simple ajax update.
>>>
>>> my view:
>>>     <div part="my_id">N/A</div>
>>>     <form with="&this" action="do_something" update="my_id"><submit
>>> label="Do Something"/></form>
>>>
>>> error:
>>> invalid part="my_id" attribute on <div>
>>>
>>> does anybody have an idea whats wrong? I use 2.0.0pre8
>>>
>>> thanks
>>> alex.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "Hobo Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/hobousers?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Hobo Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/hobousers?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to