Version: 2010.2.929.40
VS 2010, C# 4.0
I'm adding a CustomValidator to a RadAsyncUpload control. I found the post that states that the ControlToValidate must NOT be set to validate this type of control, so I am not setting it.
The validation works, and the error shows up, but Microsoft's built-in function ValidatorSetFocus(val, event) { is being overridden by the method in Telerik.Web.UI.Input.TextBox.RadInputScript.js, and that method is dependent upon the ControlToValidate and is throwing a JavaScript error when trying to set the style of the rad upload control.
This is what is being executed in lieu of Microsoft's code. g is always null because d.controltovalidate is undefined so getting/setting g.style causes the "there is no 'style' property in 'null'" exception.
Here is my client side validator for the RadAsyncUpload control. Nothing different than what is in the forum posts except for that in my case rau does not have a GetUploadedFiles() method so I go directly to the internal property _uploadedFiles. Not sure why that is the case.
VS 2010, C# 4.0
I'm adding a CustomValidator to a RadAsyncUpload control. I found the post that states that the ControlToValidate must NOT be set to validate this type of control, so I am not setting it.
The validation works, and the error shows up, but Microsoft's built-in function ValidatorSetFocus(val, event) { is being overridden by the method in Telerik.Web.UI.Input.TextBox.RadInputScript.js, and that method is dependent upon the ControlToValidate and is throwing a JavaScript error when trying to set the style of the rad upload control.
This is what is being executed in lieu of Microsoft's code. g is always null because d.controltovalidate is undefined so getting/setting g.style causes the "there is no 'style' property in 'null'" exception.
if
(
typeof
(ValidatorSetFocus)==
"function"
){ValidatorSetFocus=
function
(d,a){
var
g;
if
(
typeof
(d.controlhookup)==
"string"
){
var
f;
if
((
typeof
(a)!=
"undefined"
)&&(a!=
null
)){
if
((
typeof
(a.srcElement)!=
"undefined"
)&&(a.srcElement!=
null
)){f=a.srcElement;
}
else
{f=a.target;
}}
if
((
typeof
(f)!=
"undefined"
)&&(f!=
null
)&&(
typeof
(f.id)==
"string"
)&&(f.id==d.controlhookup)){g=f;
}}
if
((
typeof
(g)==
"undefined"
)||(g==
null
)){g=document.getElementById(d.controltovalidate);
}
var
c=
false
;
if
((g.style)&&(
typeof
(g.style.visibility)!=
"undefined"
)&&(g.style.visibility==
"hidden"
)&&(
typeof
(g.style.width)!=
"undefined"
)&&(document.getElementById(g.id+
"_text"
)||document.getElementById(g.id+
"_dateInput_text"
))&&(g.tagName.toLowerCase()==
"input"
||g.tagName.toLowerCase()==
"textarea"
)){c=
true
;
}
if
((
typeof
(g)!=
"undefined"
)&&(g!=
null
)&&(g.tagName.toLowerCase()!=
"table"
||(
typeof
(a)==
"undefined"
)||(a==
null
))&&((g.tagName.toLowerCase()!=
"input"
)||(g.type.toLowerCase()!=
"hidden"
))&&(
typeof
(g.disabled)==
"undefined"
||g.disabled==
null
||g.disabled==
false
)&&(
typeof
(g.visible)==
"undefined"
||g.visible==
null
||g.visible!=
false
)&&(IsInVisibleContainer(g)||c)){
if
(g.tagName.toLowerCase()==
"table"
&&(
typeof
(__nonMSDOMBrowser)==
"undefined"
||__nonMSDOMBrowser)){
var
e=g.getElementsByTagName(
"input"
);
var
b=e[e.length-1];
if
(b!=
null
){g=b;
}}
if
(
typeof
(g.focus)!=
"undefined"
&&g.focus!=
null
){
if
(c&&document.getElementById(g.id+
"_text"
)){document.getElementById(g.id+
"_text"
).focus();
}
else
{
if
(c&&document.getElementById(g.id+
"_dateInput_text"
)){document.getElementById(g.id+
"_dateInput_text"
).focus();
}
else
{g.focus();
}}Page_InvalidControlToBeFocused=g;
}}};
Here is my client side validator for the RadAsyncUpload control. Nothing different than what is in the forum posts except for that in my case rau does not have a GetUploadedFiles() method so I go directly to the internal property _uploadedFiles. Not sure why that is the case.
function
radAsyncUpload_OnClientValidate(source, arguments) {
var
rau = $find(
"<%= rauUpload.ClientID %>"
);
arguments.IsValid = rau._uploadedFiles.length > 0;
}
Anyone have any thoughts?? I can't see why the RadInputControl.ValidatorSetFocus would be overriding the validation on an upload control...
Thanks!
Thad