Hello Simon,

I assume you've subclassed org.apache.tapestry.form.validator.Validator?
The "false" field is passed as a parameter to the method:
validate(IFormComponent formField, ValidationMessages messages, Object
object)

But you don't need to worry about passing it to the validation delegate.
This is taken care of by Tapestry. You only need to throw ValidatorException
from the validate() method.

None of your compoents use any validator. I just wonder, how do you validate
you fields?

Hope this helps,
 
</Firas>


-----Original Message-----
From: Simon Raveh [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 22, 2006 8:26 PM
To: Tapestry users
Subject: For component and Validation Deligate

Hi,

Sorry for the second post, I didn't get any response from  the first one so
I will try to make myself clearer.

I have a  For component that includes TextField components, when the form
submitted I'm looping over all the values to perform validation.

My problem is that when I find an error I don't know which component I need
to pass to the validation delegate.

 For example here is a snapshot from my page specification

 <component id="for" type="For">
        <binding name="source" value="ognl:list"/>
        <binding name="value" value="ognl:nameServer"/>
        <binding name="element" value="literal:tr"/>
    </component>

    <component id="hostname" type="TextField">
        <binding name="value" value="nameServer.hostName"/>
        <binding name="displayName" value="message:hostname-label"/>
    </component>

    <component id="ips" type="TextField">
        <binding name="value" value="nameServer.ips"/>
        <binding name="displayName" value="message:ips-label"/>
    </component>

And here is the Html part

<tr jwcid="for">
     <td><span jwcid="hostname">ns1.au</span></td>
      <td><span jwcid="ips">203.1.5.1</span></td>  </tr>

Let's assume that the For component  loops 3 times it means that I will have
3 "hostname" TextField components rendered in my page.  Now during
validation I find that one of the values is wrong how can I find the right
TextField component to pass to the validation delegate?

I tried using the method getComponent passing the component name "hostname"
but this always marks the last TextField  as in error. If  I try using the
component id as I see it in the html source
("hostname_0")  I get an exception that the component does not exist.

Any help appreciated.

Simon    



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

Reply via email to