On Thu, Nov 4, 2010 at 12:25 AM, Jeremy Thomerson
<[email protected]> wrote:
> On Wed, Nov 3, 2010 at 10:34 PM, Troy Cauble <[email protected]> wrote:
>
>> Typically, one sets a FormComponent's ID to match the data model.
>> My form is generated from data, so the IDs are a recursive set of
>> "fieldFrag",
>> "list", "blockFrag", "label", "value" and RepeatingView#newChildID().
>>
>> My data on the other hand is represented by HashMap<String,String>
>> and CompoundPropertyModel. The keys are generated.
>>
>> This works fine when my form has a Model before I construct it.
>> Where each FormComponent is constructed I do this.
>>
>> new PropertyModel<String>(getDefaultModel(), key);
>>
>> Anyway, PM doesn't like it when the first arg is null. So I can't support
>> using setDefaultModel() after the form components are instantiated.
>>
>> How can I support setDefaultModel() ? ComponentPropertyModel looks
>> like it might work if it wasn't read only.
>>
>> Thanks,
>> -troy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> If your form is using a compoundpropertymodel, your form components don't
> need an explicit property model.
....
> TextField("someKeyThatRepresentsAPropertyOnTheThingReturnedByAboveModel"));
My issue is that "someKeyThatRepresentsAPropertyOnTheThing..."
is also "theIdThatMatchesInTheHtml".
But my form is generated on-the-fly from external data. So the HTML
IDs are always "value"
or "label". There are many "value" and "label" ids in my generated forms.
Here's a more concise summary of my problem:
I'm trying to leverage a CompoundPropertyModel, but since my form is
generated on-the-fly,
a FormComponent's ID to match the HTML cannot be the ID to match the DATA.
How can I effectively have these IDs be different? This works
new PropertyModel<String>(getDefaultModel(), dataKey);
but only if the model is set before this is called.
Otherwise t throws an exception. Also, I assume a later switch by
Form#setModel()
would fail because we're already bound to the original. I want the late binding
that (I think) a standard FormComponent "id" string gets.
ComponentPropertyModel looks like it might work if it wasn't read only.
Do I need to write something like ComponentPM?
Thanks!
-troy
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]