If I get this right, there is some kind of iteration over objects inside
the form component.
When the form is submitted, the iteration will be performed again, this
one updating the values.
then you add an "action" binding to the submit, and persist the whole
list of obejcts which were updated:
<form jwcid="@Form">
<div jwcid="@For" source="ognl:objects" value="ognl:currentValue">
<input jwcid="@TextField" value="ognl:currentValue.name"/>
</div>
<input jwcid="@Submit"/>
</form>
the currentValue property will point to the current iteration value, and
the input will update each object in the iteration.
Did I get it right this time?
Cheers,
Ron
Skorpien126 wrote:
I´m not sure I´ve I understand you in the right way. Updating one Component
is not the problem, I stillt tried taht and it works.. I want that my
ContainerElement includes the "@Form" and in the Form tag the dynamic
Number of Components is included. So the ConatinerElement have to take care
of binding and updating the values of the Subcomponent.
Ron Piterman-2 wrote:
There are some approaches to that problem, one approach would be to use
the parameter binding for that:
The component gets a paraemter from its container, and is responsible to
update the parameter.
Say you have a property on your page/container component:
public Data getData() {...}
public void setData( Data data ) { // now perform the save }
you pass "data" as a paraemter binding to your component which includes
the form, and on your submit listener, after verifying everything is
fine, you call setData:
@Parameter public abstract Data getData();
public abstract void setData( Data data );
public void doSubmit() {
// validata...
// check that everything is ok...
if (getDelegate().getHasErrors() )
return;
setData( getData() );
}
Another approach would be to use an IActionListener as paramter and
invoke it - this is the approach I take usually.
Hope that helps,
Cheers,
Ron
Skorpien126 wrote:
Hi...
I´ve another Post, describing the same problem. In my eyes it is one the
things which should be solved more than one times. So I will give a whole
describtion about what I want.
OK... i have ca 30 tables each one, holding information about 1 product.
Lets say one table holds information of chairs, the other of tables and
so
one. Each Table has a dynmamic number of Columns. Maybe an id, describing
text, a date.. . For each Type I´ve build a subcomponent ...
DateComponent,
StringComponent and so on. The Subcomponents include the "value"
(String,date ...) the validation and maybe some further functionality.
Ok... when openening a Page I get an Id with which I create a
Containercomponent "RequestContainer"(PERSISTBEAN) ... this Container
includes a Collection of "Subcomponents" correspondening to the coloums
of
the depending table and also some further, unimportant informations...
Ok... so far so good. It´s not problem to visualize the information. But
I
want to update the whole Object at once. So I´ve make a form in the
Containercomponent and in the Form-Tag I iterate over the Column-Values.
The
Form invokes a SaveMethod. In which I want to write back the values of
the
validated, values of the subcomponents. My Question... How Can I get the
values of the dynamic subcomponents???? (image that it+s not possible to
bind a parameter to a dynamicList-Item) How can I check that each value
is
"correct/validated"???
If more code is needed... just ask.
Thx u... and have a nice WE.
Here Some Example Code:
ContainerComponent.html
<form jwcid="[EMAIL PROTECTED]" success="listener:saveAll">
<span jwcid="@Foreach" source="ognl:item.getList()"
value="ognl:ListItem" index="ognl:ListIndex">
<span jwcid="@If" condition="ognl:ListItem instanceof DisplayString">
<span jwcid="@DisplayString" item="ognl:ListItem"
editable="true"/>
</span>
<span jwcid="@If" condition="ognl:ListItem instanceof DisplayDate">
<span jwcid="@DisplayDate" item="ognl:ListItem"
editable="true"/>
</span>
...
</span>
<form jwcid="@bf:BeanForm"
DisplayString.html
<span jwcid="@If" condition="ognl:editable">
<input type="text" jwcid="ColoumNameComponent"/><br/>
<br/>
<textarea jwcid="contentComponent" cols="70" rows="10">
Der Inhalt halt...
</textarea>
<p></p>
</span>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]