Sorry, panicing for a moment there :O - OK, I see the way the javascript tag works. It seems there no long validate function?

I think I have found the cause of my problem. In my dynaform definition, I set my id field type to Long - and when I enter a non-Long value in the form, the dynaform rejects it first and the dynaform long value remains null - therefore the validateLong() method will ignore it, because the validate long method can only validate a string. Is that so? Should I keep all my fields as strings in my form definition?


txs Adam



Kris Schneider wrote:
Okay, it sounded like you were just concerned with server-side validation. Try
something like:

<head>
  <html:javascript formName="/action/path" method="validateForm"/>
  ...
</head>

<body>
  ...
  <html:form action="/action/path" onsubmit="return validateForm(this);">
  ...
</body>

There are other best practices for organizing the "static" JavaScript, but try
to get something working before worrying about that...

Quoting Adam Hardy <[EMAIL PROTECTED]>:


In that case then there won't be any javascript validation set up automatically!

Is that the only difference between DynaValidatorActionForm and DynaValidatorForm?

I still haven't got this working. although I'm one step further.



Kris Schneider wrote:

If you're using DynaValidatorActionForm, the name attribute of the form

element


in validation.xml should be the same as the path attribute of the action

element


in struts-config.xml.

Quoting Adam Hardy <[EMAIL PROTECTED]>:



Hmm., just realised the name of the form here is actually the action mapping path. Should I be naming the forms in validation.xml after the action mappings then rather than the form-beans from struts-config?


Adam Hardy wrote:



I set up the Validator to do automatic validation with normal action forms and it worked fine.

Now I'm trying to incorporate dynaforms but I'm not having any luck. I'm

not getting server-side validation carried out.

I see from delving into the source code for struts and commons-validator

that the DynaValidatorAction form .validate() method is being called, but that the following line:

Form form = resources.get(locale, formName); (578)

returns a null form and so the validation is skipped.

I've obviously missed something out on the set-up and config, but what? Can anybody cast a light on this? Meanwhile I'll carry on digging....

thanks
Adam

(struts 1.1 & validator 1.0.2)




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



Reply via email to