+2010-06-15 Marek Habersack <mhabersack@novell.com>
+
+ * WebUIValidation_2.0.js: fail gracefully if control to validate
+ is not found (webForm.ValidatorGetValue and
+ webForm.Page_ClientValidate). Fixes bug #609478
+
2009-10-05 Marek Habersack <mhabersack@novell.com>
* WebUIValidation_2.0.js: before using webFrom.Page_Validators,
webForm.ValidatorGetValue = function (controlname)
{
var el = webForm.GetElement (controlname);
+ if (el == null)
+ return null;
/* if the element has a 'value' attribute, return it */
if (typeof (el.value) != 'undefined' && el.value != null) {
webForm.ValidatorTrim = function (s)
{
+ if (s == null)
+ return null;
+
s = s.replace (/^\s+/g, "");
s = s.replace (/\s+$/g, "");
var vo = webForm.Page_Validators [v];
var evalfunc = vo.evaluationfunction;
var result = false;
+ var el = webForm.GetElement (vo.controltovalidate);
- if (!vo._enabled || !webForm.IsValidationGroupMatch(vo, group)) {
+ if (el == null) {
+ result = true;
+ webForm.ValidatorSucceeded (vo);
+ } else if (!vo._enabled || !webForm.IsValidationGroupMatch(vo, group)) {
result = true;
webForm.ValidatorSucceeded (vo);
- }
- else {
+ } else {
result = evalfunc.call (this, vo);
}
var ControlToValidate = validator.controltovalidate;
var ctrl_value = webForm.ValidatorTrim (webForm.ValidatorGetValue (ControlToValidate));
-
+
if (ctrl_value == webForm.ValidatorTrim (InitialValue)) {
webForm.ValidatorFailed (validator);
return false;