Re: RE: BSelect and <input> elements of type radio and checkbox?
"Diez B. Roggisch" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
> Is that correct? I didn't mention this approach in my email, but it works
No. Lets say our basic form model (which is a TemplateModel) is called foo.
Now we have a value bar which can be selected from a list of values - either
one (select with multiple = false and a radiobutton group), or several
(select with multiple=true or checkboxgroup).
Now the RepopulationFormMap produces a (iterative) child model, called
foo_bar. This enumerates the item-map for key and value (the latter one is
usually the label for the check/radio-boxes, the first one is a
BToggleButton)
If you directly bind the element bar, you end up with a select-element. Or you
bind the foo_bar-model. This of course requires you to create the appropriate
iterative directives. Just take a look into the repopulation-html:
<tr class="Dir::Iterate_Start.ExampleModel_GROUP
Dir::Iterate_Next.ExampleModel_GROUP">
<td><!-- This and the following tr
demonstrate the usage of groups of radiobuttons. It is done
by the creation of a child template
model which follows a special nomenclature for
its name: The name of the parent
model (ExampleModel) is joined with an underscore and
the elements name.
Please notice that the model
contains a KEY, which is the actual BComponent, and a
VALUE representing (in general) the
text associated with it. This could of course be a
arbitrary BComponent or node.
-->
<input
class="Dir::Get_Data.ExampleModel_GROUP.KEY" type="radio">
<span
class="Dir::Get_Data.ExampleModel_GROUP.VALUE">[VALUE]</span>
</td>
</tr>
<tr
class="Dir::Iterate_End.ExampleModel_GROUP Dir::Discard">
<td>[DISCARD]</td>
</tr>
<tr
class="Dir::Iterate_Start.ExampleModel_CHECKBOX
Dir::Iterate_Next.ExampleModel_CHECKBOX">
<td><input
class="Dir::Get_Data.ExampleModel_CHECKBOX.KEY" type="checkbox">
<span
class="Dir::Get_Data.ExampleModel_CHECKBOX.VALUE">[VALUE]</span>
</td>
</tr>
<tr
class="Dir::Iterate_End.ExampleModel_CHECKBOX Dir::Discard">
<td>[DISCARD]</td>
</tr>
Do you get an idea how it works?
Regards,
Diez