Closed Bug 73049 Opened 25 years ago Closed 24 years ago

ValidateNumberString should show error message if user input string is empty

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.5

People

(Reporter: cmanske, Assigned: cmanske)

Details

Attachments

(9 files)

We use the JS method ValidateNumberString(value, minValue, maxValue) to detect when a user enters a number outside of allowable range, but if the input string ("value") is empty, we don't show the error dialog. We should simply show the error dialog with a similar message as we do now.
OS: Windows NT → All
A bit more involved than I hoped. I turns out that the only case where we really want to force the input to have a value is for "row" and "columns" in table dialogs. This fix is general in case there's some other users in the future.
Status: NEW → ASSIGNED
Whiteboard: FIX IN HAND need r=, sr=
Target Milestone: --- → mozilla0.9
Why does EdTableProps.js have a function "ValidateNumber" but no other property dialogs do? Other dialogs (as well as EdTableProps.js) seem to call ValidateNumberString in EdDialogCommon.js. Why haven't you propagated the additional parameter in ValidateNumberString to all callers? Have you checked every usage of ValidateNumberString to be sure that we aren't requiring any of those values?
>Why does EdTableProps.js have a function "ValidateNumber"...? Simple factoring. No other dialog needed the complicated code that table attributes require because of "%" vs. pixels issues, etc. > Why haven't you propagated the additional parameter in ValidateNumberString? Default (missing = "null) parameters are OK in JS. >Have you checked every usage... Yes. It turned out only the "row" and "column" that needed the new param to be "true".
>>Why does EdTableProps.js have a function "ValidateNumber"...? >Simple factoring. No other dialog needed the complicated code that table >attributes require because of "%" vs. pixels issues, etc. Other dialogs do have % vs pixels; why is this different? Why is ValidateNumber function in table js rather than the common/shared dialog JS file? I'm aware of the defaults for JS, just making sure that you are intentionally doing that. I'm glad that no other dialogs rely on this new parameter.
Latest patch includes change to ValidateNumber input param: input widget passed in instead of its ID for consistency with 2nd parameter ("listWidget"). ValidateNumber() may be used by Horizontal Rule and Image Dialogs -- file separate bugs if we want to do that.
P3 priority
Priority: -- → P3
Adding review keyword -- ready for final reviews
Keywords: review
Brade: latest patch should clear up problems you found in your previous testing.
Keywords: patch
r=brade
Need just sr now.
Whiteboard: FIX IN HAND need r=, sr= → FIX IN HAND need sr=
Please rename 'error' to gError if it really is global, or rewrite the code to not require a global at all. 'error' is way too prone to name conflicts for a global variable. An alternative way to pass back this error condition would be to throw an exception, which might make the code cleaner. Also, will this kind of validation still work when we change to using key listeners which can grab keypresses before they get to the input field? Fix 'error' and sr=sfraser
Ok, I've changed "error" to "gValidationError" for clarity. This validation is called separately from the "filter" validation that happens on typing inside an edit field, so it will have no effect on future changes to that.
Removing keywords since reviews are finished
Keywords: patch, review
Whiteboard: FIX IN HAND need sr= → FIX IN HAND
checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Whiteboard: FIX IN HAND
currently if you have no value for row and column, the OK button is dimmed out...so the user won't see any error panel pop up...is this what this bug is all about?
In the 9-06 Build: 1. create a table with 2 rows, 2 columns 2. right click on the table and select properties 3. change the row and columns number to 0 RESULT: Receive error: "The number you entered (0) is outside the allowed range. Please enter a number between 1-1000." 1. create a table with 2 rows, 2 columns 2. right click on the table and select properties 3. change the row and columns number to null RESULT: I get a message informing me that: "Reducing the number of rows or columns will delete table cells and their contents. Do you really want to do this?" If I click "Delete Cells" on this the table, and it's contents are deleted. Is this the correct behavior, should I see the first error message in both instances, or as Sujay pointed out - should the OK button be greyed out (like it is when you atempt to create a table with no value for rows or columns)?
reopen bug based on previous comments First example is correct behavior. Second example (no data in edit fields) is wrong.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla0.9 → mozilla0.9.5
I think we should have opened a new bug on the specific issue noted.
Status: REOPENED → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 25 years ago24 years ago
Resolution: --- → FIXED
verified. new bug opened
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: