tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

TRequiredFieldValidator attached to TCheckBox client side implementation broken in 3.1.7 #261

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a page containing TCheckBox and attached TRequiredFieldValidator
2. Submit the Page without checking the TCheckBox element

What is the expected output? What do you see instead?

Should display the ErrorMessage/Text of TRequiredFieldValidator without
submitting the form to the server.

This used to work in previous versions (e.g. 3.1.6)

This is not critical as the server side implementation works as expected,
but should be fixed asap.

Original issue reported on code.google.com by rojaro@gmail.com on 20 Apr 2010 at 2:21

GoogleCodeExporter commented 9 years ago
This bug was introduced in r2753
In the refactored getValidationValue() we have

(validation3.js @line 1158)
if(Object.isString(value))
  return this.trim(value);
else
  return value;

which is causing problems because in case of TCheckBox value is null and null 
is returned whereas the validation process expects not null value or ""

this check is also redudant because we're calling not trim() but this.trim() 
which does the check and ensures correct values:

(validation3.js @line 1058)
trim : function(value)
{
  return typeof(value) == "string" ? value.trim() : "";
},

so the  introduction of getRawValidationValue() doesn't seem to be well 
thought-through because the only thing it does is adding the unneeded 
isString() checking and adding this bug

my opinion is we should return to having only getValidationValue()

diff is attached

Original comment by piotrows...@gmail.com on 3 Nov 2010 at 12:31

Attachments:

GoogleCodeExporter commented 9 years ago
TRegularExpressionValidator uses RawValidationValue().
The content of the field was trimmed before the validation as a consequence if 
regex was forbidding leading or ending spaces, it would pass clientside 
validation.

About the code in getValidationValue, It can't return "" if it's not a 'string' 
because Validation value can be a 'date' or an integer...
I would suggest to reproduce the switch/case comportement of previous 
getValidationValue() to know if we need to trim or not.

Original comment by E.Let...@gmail.com on 17 Nov 2010 at 10:15

Attachments:

GoogleCodeExporter commented 9 years ago
fixed in r2910. While this was not a big problem when validating a TCheckBox, 
it was worst when validating a TActiveCheckBox: you'd get non error report from 
the validator at all.

Original comment by ctrlal...@gmail.com on 11 May 2011 at 2:17