In any case, disable client-side validation for the dojo date text field?

In my example below I use dijit.form.DateTextBox:

<input type="text" name="startDate" dojoType="dijit.form.DateTextBox" constraints="{datePattern:'MM/dd/yyyy'}"  value='<c:out value="${sessionScope.adminMessageForm.startDate}"/>' />

So, for example, if the user starts to enter "asdf" into the date, the field turns yellow and the error message " The value entered is not valid." appears . Even if I delete constraints="{datePattern:'MM/dd/yyyy'}", it still checks.

Without going into details as to why, I would like to be able to save dojoType and still prevent validation in certain circumstances.

+3
source share
3 answers

Try overriding the validation method in your markup.

This will work (just tested):

<input type="text" name="startDate" dojoType="dijit.form.DateTextBox" 
  constraints="{datePattern:'MM/dd/yyyy'}"  
  value='<c:out value="${sessionScope.adminMessageForm.startDate}"/>'
  validate='return true;'
/>
+6
source

- dojoType . dojoType . , .

+1

, ValidationTextBox , , "".

ValidationConditionalTextBox :

    enableValidator:function() {
        this.validatorOn = true;
    },

    disableValidator: function() {
        this.validatorOn = false;
    },

- : function() :

        if (this.validatorOn)
        { ... }

, validatorOn ( javascript). , enableValidator(). JavaScript :

http://lilawnsprinklers.com/js/dijit/form/ValidationTextBox.js

+1
source

Source: https://habr.com/ru/post/1696440/


All Articles