Joost Kuif wrote:
Hi people,


I have a formdefinition with multiple fields. For some of these fields
uniqueness must be checked against a table in a database. I want to
check this towards the database with the use of one stored procedure. I
tried to with something like the example below, but this didn't work.
The page is left without a validation warning on the field. Does anyone
have an idea how to do setting of a validationerror of a field outside
of the field?

<fd:field id="blogshortcode" required="true">
...
<fd:validation>
 <javascript>
//call stored procedure here and optionally //complain that anotherfield's value is already in use with:
  widget.getParent().lookupWidget("anotherfield").setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("not_unique"
));
 </javascript>
</fd:validation>
</fd:field>

<fd:field id="anotherfield" required="true">
...
</fd:field>



Any help would be appreciated.

Joost


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


I've done this as follows
<fd:validation>
    <fd:javascript>
        if(determinValidation())
        {
            var form = widget.form;
form.lookupWidget('widget_name').setValicationError(new Packages.org.apache.cocoon.forms.validation.ValidationError('Error')
            return false;
        }
    </fd:javascript>
</fd:validation>


The differences I see are:
* using widget.form to locate the form object and then getting the other widget from the form.
* adding the fd: to javascript
* returning false to ensure the error is noted.

Hope this helps

Andrew

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