RE: Struts Validator changing the "key" in the validator.xml

2002-03-11 Thread Ben Kafka

Thanks Dave!

-Original Message-
From: David Winterfeldt [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 11:21 AM
To: Struts Users Mailing List
Subject: Re: Struts Validator changing the "key" in the validator.xml



There are some examples here.
http://home.earthlink.net/~dwinterfeldt/overview.html#i18n

> In the Application resources properties currently I
> have "{0} is invalid"
> for my "errors.invalid" tag. What I would like to
> have is "{0} is invalid
> because {1}" but I don't know how to define the {1}
> in the validation.xml
> and validation-rules.xml.


   

   
   
  mask
  ^[a-zA-Z]*$
   


or you can override the default message:


   
   

   
  mask
  ^[a-zA-Z]*$
   


David

--- Ben Kafka <[EMAIL PROTECTED]> wrote:
> Was wondering if there is a way to access a unique
> string to display for a
> "required" error in the javascript function under
> validator-rules.xml. Right
> now the following happens:
> If in the validator.xml file I specify the  key=regform.firstname.displayname" > it is
> used by both the "required" and "mask" javascript
> functions to display a
> canned error like
> Firstname is invalid.
> Firstname required.
>
> How can I differentiate these. For instance I would
> like to say..
> Firstname in invalid because only upper and lower
> case letters are allowed.
>
> In the Application resources properties currently I
> have "{0} is invalid"
> for my "errors.invalid" tag. What I would like to
> have is "{0} is invalid
> because {1}" but I don't know how to define the {1}
> in the validation.xml
> and validation-rules.xml.
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

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


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




Struts Validator changing the "key" in the validator.xml

2002-03-11 Thread Ben Kafka

Was wondering if there is a way to access a unique string to display for a
"required" error in the javascript function under validator-rules.xml. Right
now the following happens:
If in the validator.xml file I specify the  it is
used by both the "required" and "mask" javascript functions to display a
canned error like
Firstname is invalid.
Firstname required.

How can I differentiate these. For instance I would like to say..
Firstname in invalid because only upper and lower case letters are allowed.

In the Application resources properties currently I have "{0} is invalid"
for my "errors.invalid" tag. What I would like to have is "{0} is invalid
because {1}" but I don't know how to define the {1} in the validation.xml
and validation-rules.xml.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Struts Validator - mulitple forms on one page

2002-03-05 Thread Ben Kafka

Hi,

  Would like to know if I can validate using js with multiple forms in one
file. Currently I'm having a problem. When I use  and
  only the last one specified
works. The other form gives me a javascript error. Is there anyway around
this?



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Struts Validator Questions

2002-03-01 Thread Ben Kafka


Hi,

  Was able to fix the first problem by going into the js and checking for
"select-one" and value=0.

  Regarding the 2nd issue, I have specified the class where I put the method
in the
valiation-xml e.g. my clasname="com.mypackagename.ui.RegistrationForm"  and
I have
a method there called
validateTwoFields(Object bean,ValidatorAction va,... just like yours.

The only difference is that in errors.add() I have
errors.add(field.getKey,StrutsValidatorUtil.getActionError(.)
and you have
errors.add(field.getKey.ValidatorUtil.getActionError(.

I am compiling and running okay, but it never gets to this routine.
(Thanks for your help by the way)

Ben

-Original Message-
From: David Winterfeldt [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 11:57 AM
To: Struts Users Mailing List
Subject: Re: Struts Validator Questions



--- Ben Kafka <[EMAIL PROTECTED]> wrote:
> Hi,
>
>I started using the struts validator package
> about a week ago and have
> the following questions:
>
> 1 - How do I get the validator to validate a
> required field for a selection
> box?
>   My selection is on an integer property. I noticed
> in the
> validator-rules.xml file it is checking for type
> "select-one". What "type"
> is a ? I tried replacing "select-one"
> with "select" but it
> still doesn't find it.
The "select-one" is the correct type in Javascript for
an html:select tag.  I'm not sure what is in your
select list, but if it is an integer how can you check
that it is blank (zero length string) or null?  You
could use the range method to see if it falls in a
range or write your own.

>
> 2 - Cannot get the two password comparison example
> working. I put in the
> code specified under ~dwinterfeldt. Was wondering if
> anyone has gotten this
> working. The only difference I can see in my code
> and the example was that I
> am using StrutsValidatorUtil.getActionError instead
> of
> ValidatorUtil.getActionError (the latter the
> compiler complained about no
> such method signature). Was wondering if there was a
> javascript method also
> that could be included.
No error messages?  Everything works on the same
principle.  Does the validator definition in the xml
have the same method and class defined as where the
validation method actually is (no types)?

You can make a Javascript method to match if you want
to.  You can follow one of the examples to see how to
make a generic Javascript method.  You have access to
the error message and the variables you've defined in
the Javascript.

David

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


__
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

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


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




Struts Validator Questions

2002-03-01 Thread Ben Kafka

Hi,

   I started using the struts validator package about a week ago and have
the following questions:

1 - How do I get the validator to validate a required field for a selection
box?
My selection is on an integer property. I noticed in the
validator-rules.xml file it is checking for type "select-one". What "type"
is a ? I tried replacing "select-one" with "select" but it
still doesn't find it.

2 - Cannot get the two password comparison example working. I put in the
code specified under ~dwinterfeldt. Was wondering if anyone has gotten this
working. The only difference I can see in my code and the example was that I
am using StrutsValidatorUtil.getActionError instead of
ValidatorUtil.getActionError (the latter the compiler complained about no
such method signature). Was wondering if there was a javascript method also
that could be included.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




jbuilder jsp and struts tags

2002-02-05 Thread Ben Kafka

Was wondering if anyone has been able to set break points in jbuilder6 for
struts tags when debugging jsp. I can set a breakpoint on a regular jsp tag
but not in a struts one e.g. 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: