Using the XML field validation put required on an Integer or Long field. Validation only reports an error when the value is a letter (EG: Submit with fields blank and it will fire the action instead of reporting a field error.)
Try the app at
http://www.tuxbot.net/testCase2.zip and submit the form with no values, with only letters ("asdfsad") , with numbers and then letters "111asdf", adn just numbers "1111".
no values should report that the field is required.
"asdf" reports 'Invalid field value for field "personId".'
"111aaaa" reports no error and sets the value with the aaaa stripped
"111" works
I would think that the correct behavior would be...
no values reports a field error, field required
"111aasdf" reports a field error, field must be an integer
Of course I may be an idiot and doing something wrong.
* no values when entered (into the personId field) will generate a "personId must be an integer" error message.
* "111aaa" reported no error. I believe this is a bug on XWorkBasicConverter, which convertes "111aaa" into 111. Actually it is NumberFormat.parse("111aaa") returns 1111. We might need to take ParsePosition into account and see if all the source ( eg. "111aaa") is being used to do conversion. So if not all the ParsePosition is used, then there might be an error when converting... What do you think?
* "asdf" gives 'Invalid field Value for Field "persionId"' cause webwork failed to convert it to an Integer.
> no values reports a field error, field required
I think it is reporting an error "persionId must be an integer". Is this what you mean? or am i missing the point? Or do you mean why "invalid field value ...." message is not displayed? The "invalid field ..." message will be display only if there is a failure in the conversion.
I think you are right that there is a bug in the number conversion .... What do you think? ;-)