Like this...
<fd:field id="foo" >
<fd:label>Foo:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:javascript>
return yourValidationMethod(widget);
<fd:javascript>
</fd:validation>
</fd:field>
The JS you use for validation must return true/false depending on the
validation success. There are samples of custom validation with JS in
the cocoon distribution...
Robin
On 14 Feb 2006, at 13:01, Stewart, Gary wrote:
Hello,
I'm using Cocoon 2.1.8 and attempting to develop a few CForms. I've
been working on validating the forms and for some widgets I'm
attempting to use Javascript but it doesn't seem to be working. I
looked at the sample files and could only find Javascript
validation for the whole form. Is it possible to do something like:
<fd:field id="foo" >
<fd:label>Foo:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<javascript>
return false;
<javascript>
</fd:validation>
<fd:on-value-changed>
<javascript>
this.validate();
</javascript>
</fd:on-value-changed>
</fd:field>
obviously the validation would normally be more complex but I
figured this is the easiest to get to work.
Also does it matter if you use the namespace <fd:javascript /> or
should javascript always be in the xmlns="" namespace?
Thanks (and sorry to keep throwing so many CForms questions),
Gary
*****************************************************************
The information contained in this message may be confidential or
legally privileged and is intended for the addressee only, If you
have received this message in error or there are any problems,
please notify the originator immediately. The unauthorised use,
disclosure, copying or alteration of this message is
strictly forbidden.
*****************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]