Ok I figured it out: you use the id attribute to generate a unique id
for a particular part:
- <collection part="&model_id_class"/>
- <form with="&this.new" owner="list_item"
update="&model_id_class" >
+ <collection part="notes" id="&this_parent"/>
+ <form with="&this.new" owner="list_item"
update="&this_parent.to_s" >
This creates the following output:
<div class='part-wrapper' id='List Item 1'>
and so on for each List Item in the table, with corresponding forms
with the attribute onsubmit="Hobo.ajaxRequest(this, ['List Item 1'],
{resetForm:true}); return false;" Nice!
A further question: How would I get a nice dasherized id ("list-
item-1") instead of the to_s version?
Thanks,
Andy
On Oct 23, 10:54 am, Andy Orahood <[EMAIL PROTECTED]> wrote:
> I've got a table. In each row, I'd like to have a cell containing a
> text field that dynamically updates a collection also in that cell. So
> I need a uniquely identified part for each of these cells. I thought I
> could use the model_id_class helper to give me a unique id to pass to
> the part attribute like this (simplified to remove the irrelevant
> fields):
>
> <table:list-items fields="notes">
> <notes-view:>
> <collection part="&model_id_class"/>
> <form with="&this.new" owner="list_item"
> update="&model_id_class" >
> <field-list />
> <submit: label="Add note"/>
> </form>
> </notes-view:>
> </table:list-items>
>
> But I get an "invalid part" error whenever I put anything other than
> text in the value for part. Even underscores cause the error.
>
> Thanks,
> Andy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---