Hi Paul,

Let me explain in detail : I have an application that needs to collect info
about a primary applicant (applicant1) and one or more co-applicants
(coapp1, coapp2 etc.) . So, we could be presenting the same fields from the
domain model multiple times in the page - like :

Primary App info :
<s:textfield name="application.primaryApp.address.addressline1"../>
<s:textfield name="application.primaryApp.address.addressline2"../>

Co=App info :
<s:textfield name="application.coApp1.address.addressline2"../>
<s:textfield name="application.coApp1.address.addressline2"../>

and the error message must be specific to the corresponding applicant. Also,
the rules could be different for the co-apps than the primary apps.

Address is the domain object having fields addressline1, addressline2 etc.
and this could be tied to primaryapp or coapp. In the Action class, we have
a getApplication and setApplication alone. Also, note that we show both of
these in the same page, and the Action is the same.

I want to use visitor validation here since the fields are the same and i
don't want to repeat them N times, but just define it once in the model.

In this case, where would we define the @VisitorFieldValidator and the
field-specific validations (@EmailValidator,  @StringLengthFieldValidator
etc.)

Thanks,
Joseph

On 8/11/07, Paul Benedict <[EMAIL PROTECTED]> wrote:
>
> So your error messages are customized based on user? That doesn't make
> sense
> to me. Are you sure?
>
> Paul
>
> On 8/10/07, j alex <[EMAIL PROTECTED]> wrote:
> >
> > Hi All,
> >
> > This is somewhat related to Matt's post on conditional validation at
> > http://www.nabble.com/Re:-Conditional-validation-p11990883.html ; i dont
> > have the original email on struts-user (joined the group only last
> week!)
> > to
> > reply to :
> >
> > I need some help regarding the extent to which we can apply visitor
> field
> > validation. Say, my domain object (Address - with attributes addrline1,
> > addrline2, ZIP etc.) is buried deep in a hierarchy - ie
> app.user1.address;
> > and we define only "app" in the Action. Can we declare a visitor
> > validation
> > on "app" and define the  rules on Address-validation.xml ? .
> >
> > My requirement is that we could use address in different objects ; like
> > app.user1.address ; app.user2.address - and the error message needs to
> > be customized
> > depending on user1, user2 etc . It'll be elegant if the validation rules
> > are
> > defined just once for Address. Right now, the only way i know to achieve
> > is
> > to define ALL fields in the <action>- validation.xml and hardcode the
> > message for each situation ; which i think is an overkill.
> >
> > Please let me know if you've any suggestions/ideas.
> >
> > Thanks,
> > Joseph
> >
>

Reply via email to