If you put regular tags inside of <old-form>, you'll replace the
entire content. To just swap out part, use parameters:
<extend tag="form" for="User">
<old-form merge>
<field-list: (etc)>
# code goes here
</field-list:>
</old-form>
</extend>
Note the : after field-list - that makes all the difference.
--Matt Jones
On Jul 19, 2009, at 1:18 AM, bryan wrote:
>
> It's only partially working, though. I'm only getting the field-
> list. I had to copy the rest of the auto generated code from
> forms.dryml to make it work.
>
> extend tag="form" for="User">
> <old-form merge>
> <error-messages param/>
> <field-list fields="name, email_address, administrator,
> birthday" param>
> <birthday-view:>
> <input merge include-blank="&false" start-
> year="&Time.now.year - 100" end-year="&Time.now.year"/>
> </birthday-view:>
> </field-list>
> <div param="actions">
> <submit label="Save" param/><or-cancel param="cancel"/>
> </div>
> </old-form>
> </extend>
>
>
> Since I'm copying and pasting out of forms.dryml, it seems there's a
> lot of RY in my DRYml
>
> Hopefully someone else can show me what I'm doing wrong
>
> On Jul 18, 9:48 pm, bryan <[email protected]> wrote:
>> YAY!!! You got me on the right track:
>>
>> <extend tag="input" for="date">
>> <old-input merge include-blank="&true" order="month,day,year"/>
>> </extend>
>>
>> <extend tag="form" for="User">
>> <old-form merge>
>> <field-list fields="name, email_address, administrator,
>> birthday" param>
>> <birthday-view:>
>> <input merge include-blank="&false" start-
>> year="&Time.now.year - 100" end-year="&Time.now.year"/>
>> </birthday-view:>
>> </field-list>
>> </old-form>
>> </extend>
>>
>> IT WoRKs!
>>
>> On Jul 18, 6:05 pm, Montgomery Kosma <[email protected]> wrote:
>>
>>> Here's a bit of advice based on my learning experiences over the
>>> last
>>> few weeks. Not sure it'll take you all the way there, but hope it's
>>> at least directionally useful.
>>
>>> The default form for User is defined in forms.dryml.
>>
>>> <def tag="form" for="User">
>>> <form merge param="default">
>>> <error-messages param/>
>>> <field-list fields="name, email_address, administrator" param/>
>>> <div param="actions">
>>> <submit label="Save" param/><or-cancel param="cancel"/>
>>> </div>
>>> </form>
>>> </def>
>>
>>> You can override or augment this form in your application.dryml.
>>> Consistent with DRY, the "hobo" way is to declare only what differs
>>> from the default.
>>
>>> Now, I'm assuming you've added birthday to the fields on the User
>>> object. If so, then your default form (above) will include birthday
>>> in the field-list line. (Otherwise, you would do something like
>>> this:
>>
>>> <extend tag="form" for="User">
>>> <old-form merge>
>>> <field-list: fields="name, email_address, administrator,
>>> birthday">
>>> </old-form>
>>> </extend>
>>> )
>>
>>> But none of that should be necessary. Really, all you want to do is
>>> override the input being used for the birthday field. To figure
>>> that
>>> out, you have to look at the docs or the source for field-list in
>>> rapid-core.dryml and see the params it defines. As you've noted,
>>> for
>>> each field, it defines field-all:, field-label, field-view, field-
>>> tag. So you should be able to do something like this:
>>
>>> <extend tag="form" for="User">
>>> <old-form merge>
>>> <birthday-view:>
>>> <input ...>
>>> </birthday-view:>
>>> </old-form>
>>> </extend>
>>
>>> One suggestion, rather than first trying to get the input right,
>>> experiment with something simpler like the label, e.g., <birthday-
>>> label:>FOO!</birthday-label:> in the above will tell you
>>> straightaway
>>> if you have the syntax correct, and let you separate out
>>> understanding
>>> how to work with overriding the form elements from understanding how
>>> to tweak the input being used for the date.
>>
>>> On Jul 18, 8:15 pm, bryan <[email protected]> wrote:
>>
>>>> (continued)
>>
>>>> Anyway, this is what I'm currently trying (and I've tried lots of
>>>> other stuff too). Please don't be too hard on me.
>>
>>>> <extend tag="form" for="User">
>>>> <form merge>
>>>> <field-list fields="name, email_address, administrator,
>>>> birthday">
>>>> <birthday-view:>
>>>> <input:birthday merge start-year="&Time.now.year - 100"
>>>> end-year="&Time.now.year"/>
>>>> </birthday-view:>
>>>> </field-list>
>>>> <div param="actions">
>>>> <submit label="Save" param/><or-cancel param="cancel"/>
>>>> </div>
>>>> </form>
>>>> </extend>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---