3
votes

I'm trying unsuccessfully to disable client side validation for a Dojo Combo Box. I have added a dojo attribute "required" and set it to false but this still does not work. I do want server side validation to be enabled which is why I have set required="true". Can anyone see what change needs to be made to the below code?

<xe:djComboBox id="djComboBox1" required="true" disableClientSideValidation="true">
<xe:this.dojoAttributes>
<xp:dojoAttribute name="required" value="false">
</xp:dojoAttribute>
</xe:this.dojoAttributes>
<xp:selectItem itemLabel="" />
<xp:selectItem itemLabel="Apples" />
<xp:selectItem itemLabel="Oranges" />
<xp:selectItem itemLabel="Pears" />
<xp:selectItem itemLabel="Bananas" />
<xp:selectItem itemLabel="Plums" />
</xe:djComboBox>
2
What is it binded to?Frantisek Kossuth

2 Answers

7
votes

Try to override the client side validation formula of your combobox with a method which always returns true:

<xe:djComboBox
    id="djComboBox1"
    required="true"
    validatorExt="return true;">
    <xp:selectItem itemLabel="" />
    <xp:selectItem itemLabel="Apples" />
    <xp:selectItem itemLabel="Oranges" />
    <xp:selectItem itemLabel="Pears" />
    <xp:selectItem itemLabel="Bananas" />
    <xp:selectItem itemLabel="Plums" />
</xe:djComboBox>
0
votes

As far as I know you cannot disable client-side validation on Dojo form controls. Dojo is a client-side framework and the controls just make it easier to implement the Dojo versions. The validation is part of the Dojo client-side JavaScript code, not anything from the XPages server-side runtime. So the validation is intended to run client-side rather than server-side.

The standard ComboBox control will give you what you want. You may be able to reproduce the styling of the Dojo version by identifying the relevant styles using e.g. FireBug.

The other option is do the validation in your save button. There is an XSnippet that will help with marking controls invalid and posting to an xp:messages or xp:message control http://openntf.org/XSnippets.nsf/snippet.xsp?id=ssjs-form-validation-that-triggers-errormessage-controls. But this will not give the Dojo error styling, which again is part of the Dojo code rather than specifically part of the XPages runtime.