wood burning stoves 2.0*
The moose likes Struts and the fly likes validate integer works but double doesn't Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validate integer works but double doesn Watch "validate integer works but double doesn New topic

validate integer works but double doesn't

wayne xu

Joined: Feb 15, 2005
Posts: 6
Does anybody found the strange thing? struts validator works fine with integer, but not work with double in the same page. No error at all, just doesn't validate double.

Here is the code in validation.xml (I double checked the case, spell,...). I am stuck here!!

<field property="match_msnum"
<arg0 key="prompt.match_msnum"/>

<field property="matchedPrMW"
<arg0 key="prompt.matchedPrMW"/>
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Odds are, the property is not correct. Check the spelling and case.

A good workman is known by his tools.
wayne xu

Joined: Feb 15, 2005
Posts: 6
Marc, thanks for looking into it,

When I add "required, depends="required,double", only the rquired is validated on client-side, I can input none double characters with no error msg appears. (But I saw server-side validation msg saying required double this time). This also means there is no mistakes in case, spell.

The depends="required, integer" validate both required and integer on client-side.

So why the double can not be validated on client-side?

Surprisingly, I saw many validation functions such as maxlength, integer,...on my jsp page source view, but I couldn't see the double, validwhen function.

Lisa Carter

Joined: May 29, 2003
Posts: 25
I am having the same problem now. Did you ever find a solution or what's causing this?
It is sorta covered in the JavaRanch Style Guide.
subject: validate integer works but double doesn't
Similar Threads
Struts Validator-Validating an Integer Form Field
validator plugin and validate() method needs to use together
whitespace validation??
how to validate date type parameter with validator
validwhen not work, even validate double not work