Opened 10 years ago

Closed 10 years ago

#15369 closed defect (invalid)

ValidationTextBox: validate doesn't show tooltip message when the value entered is less than the constraint min value

Reported by: smaheshbhat Owned by: smaheshbhat
Priority: undecided Milestone: tbd
Component: Dijit - Form Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

The following line in validationTextBox.js is really buggy!

this._set("state", isValid ? "" : (((((!this._hasBeenBlurred || isFocused) && isEmpty) || isValidSubset) && this._maskValidSubsetError) ? "Incomplete" : "Error"));

Where as it should have been

this._set("state", isValid ? "" : (((((!this._hasBeenBlurred || isFocused) && isEmpty) && isValidSubset) && this._maskValidSubsetError) ? "Incomplete" : "Error"));                     

The reason is as follows Let me try to decipher what exactly this line does. The following set of lines replace the one liner to help me explain the issue

var inFocus = !this._hasBeenBlurred || isFocused;
var inFocusAndEmpty = (inFocus) && isEmpty;
var inFocusAndEmptyAndValidSubset = (inFocusAndEmpty) && isValidSubset;  // see below for explanation
var inFocusAndEmptyAndValidSubsetAndmaskValidSubsetError = (inFocusAndEmptyAndValidSubset) && this._maskValidSubsetError;
var isIncomplete = inFocusAndEmptyAndValidSubsetAndmaskValidSubsetError;
var status = (isIncomplete) ? "Incomplete" : "Error";
this._set("state", isValid ? "" : (status));

We compute this to know whether the value we are texting in this box is really complete or not ? However, Only if still in Focus AND content in it so far is still a valid subset then only we can say some thing is in progress and hence the value entered is 'INCOMPLETE'. Now consider a scenario where we have range between 10 to 50 and user has typed 2 and went away from the box. At this point it should decide text input in the box is complete and state should be 'ERROR'; rather with the current logic of ORing in Focus or in range we end up having it true and incorrectly concluding we are not yet done texting in that box! Rather it should have been whether it is in focus AND not in range resulting it in false; implying the text box no longer in focus;

Let me explain it in more lucidly

As of now, the decision to decide whether entering text in text box is incomplete based on the OR of the following 2 conditions

  1. Textbox still has focus
  2. The value entered so far when appended up on may be in range ( range between min and max values)

According to me OR of the above 2 is not Right because when we have entered a value less than the minimum and move away from Text box; condition 1 become false; but condition 2 still is true because the value in it even-though less as of now when appended up on, may become a valid value..

Rather Decision to have the state Incomplete only if Both of the above is TRUE; else it should go to ERROR state

Just by changing this OR to AND serves all the purpose! Hence according to me it is the Best solution.

Change History (3)

comment:1 Changed 10 years ago by bill

Component: GeneralDijit - Form
Description: modified (diff)
Owner: set to Douglas Hays
Summary: ValidationTextBox.validate doesnt show tooltip messgae when the value entered is less than the constraint min valueValidationTextBox: validate doesn't show tooltip message when the value entered is less than the constraint min value

Are you sure you tabbed away (ie, blurred) the ValidationTextBox? If you didn't, it won't flag an error because it thinks you might still be typing and thus will eventually match/exceed the minimum value.

comment:2 Changed 10 years ago by Douglas Hays

Owner: changed from Douglas Hays to smaheshbhat
Status: newpending

Please append a testcase or recreate steps to an existing test file. I ran
and in the favorite number box I entered 0 and immediately it said the number was out of range. Tabbing out and back in yielded the same result. Also in the elevation field, I entered -222222 and had the same results. I changed the favorite number constraints in my development sandbox to have a min of 10 and max of 50 and entered 2 (no definite error since I could be typing 20 and it's still focused), but then when I tabbed out the error icon shows and when I tab back I get the out of range error.

comment:3 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.