Ron you do a great Job here!!!
Now I understand a little bit more how the delegate works. It could be
compared with "ExceptionHandler" which catchs "Exceptions" thrown by the
included subcomponents. (unimportant how deep the hierachy is).

But Now I have another Prob. I have multible Textareas in my Register page.
The Situation is: I have a Register Page including multible Textareas. When
I Submit the form and one of the validators "HasErrors" the textareas get
their InitialValues. Is thought Tapestry "bind" values in any Case?!?!?



Ron Piterman-2 wrote:
> 
> Tapestry uses for validation the ValidationDelegate - I would recomment 
> you stick to it, it will make your life much easier, and it is one of 
> tapestry's most powerfull features:
> 
> You can use validators on each of your fields, and that doesn't mean 
> they have to be preconfigured - you can use a dynamic list of Validator 
> objects, depending on the current iteration (maybe not all a required).
> 
> So all you have to do is
> 
> @Bean
> public abstract ValidationDelegate getDelegate();
> 
> and
> 
> <form jwcid="@Form" delegate="ognl:deleagte">
> 
> and in your submit listener:
> 
> if ( getDeleagte().getHasErrors() )
>    return;
> 
> Take a look at Form validation in the users guide.
> 
> Cheers,
> Ron
> 
> 
> 
> 
> Skorpien126 wrote:
>> Thats not exactly the situation... here a descreption depending on your
>> code
>> snippet.
>> 
>> 
>> <form jwcid="@Form">
>>   <div jwcid="@For" source="ognl:objects" value="ognl:currentValue">
>>         <span jwcid="@If" condition="ognl:currentValue instanceof
>> StringColumn"
>>               <input jwcid="@StringComponent"
>> value="ognl:currentValue"/>(includes Validation and further function)
>>         </span> 
>>          <span jwcid="@If" condition="ognl:currentValue instanceof
>> DateColumn"
>>               <input jwcid="@DateComponent" value="ognl:currentValue"/>
>> (includes Validation and further function)
>>         </span> 
>>   </div>
>>   <input jwcid="@Submit"/>
>> </form>
>> 
>> ....
>> the Problem is that I don´t know how to check the Validation of each
>> component in the "doSubmit-Method". I need a way to iterate over the
>> "subcomponents"!?!?!
>> 
>> Maybe your way would work, but then it´s incosistent to my hierachy. 
>> 
>> P.S. Thx for help.
>> 
>> 
>> 
>> 
>> 
>> Ron Piterman-2 wrote:
>> 
>>>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]
>>>
>>>
>>>
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Dynamic-Working-with-Tapestry...-tf2697699.html#a7607122
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to