when click submit button, call a _javascript_ to validate the input, I use the regular _expression_ for validation, which is very powerful.
and if the validation checking is successful, then continue, otherwise give a alert.
Hi Christofer,
I think you will find that the _javascript_ in resources/forms-lib.js is very much client side. Either that or the cocoon developers have devised a way to make statements like document.body.appendChild(element) work server-side! ;-)
Any ideas anyone?
regards
Andrew
On 10/07/06, Christofer Dutz <[EMAIL PROTECTED]> wrote:Hi Andrew
How about some print-statements?
As far as I know the java-script is executed server-side, so an alert will not work. If you do a "print(case)" this should output to your console the value of case.
Regards,
Christofer
Von: Andrew Madu [mailto: [EMAIL PROTECTED]]
Gesendet: Montag, 10. Juli 2006 09:52
An: [email protected]
Betreff: ft:form-template onSubmit issue
Hi,
I have a cform which has _javascript_ validation on some form fields (widgets):
<fd:_javascript_>
if (case) {
return true;
} else {
return false;
}
</fd:_javascript_>
<fd:widgets>
</fd:widgets>
Basically what I want to happen is that when <form> is returned a value of 'true' to indicate that all form fields have been validated successfully a _javascript_ function is carried out, for example an alert is triggered alert("success").
I have edited both resources/forms-lib.js and resources/forms-field-styling.xsl and absolutely nothing is happening. Firstly how can I determine in _javascript_ whether true has been returned to the form after it has been submitted? I have tried a check on document.Form.submitted and had no joy with that. Any ideas?
regards
Andrew
