Hi,
I'm having a problem with a simple client side validation. I have a check-box 'I agree' disclaimer and the form cannot be submitted until the box is checked. The javascript for this is:
function checkValid(){
var chk = document.getElementById('<%= chkValid.ClientID %>');
if (chk.checked){
return true;
}else{
alert('you must agree to the disclaimer in order to save');
return false;
}
}
I then set the 'onclick' attribute of the asp:button to use the function.
This works fine until the radAjax control is used, then the callback is not fired.
I tried using the RadAjax example in the help file but find that the documentation is incorrect for version 2008.1.528.20 as the documentation refers to the "OnRequestStart" event but the control uses "ClientEvents-OnRequestStart".
Also the statement to get the clientid of the control that fired the ajax request is
var eventTarget = eventArgs.EventTarget;
which is wrong and happens to be
I'm having a problem with a simple client side validation. I have a check-box 'I agree' disclaimer and the form cannot be submitted until the box is checked. The javascript for this is:
function checkValid(){
var chk = document.getElementById('<%= chkValid.ClientID %>');
if (chk.checked){
return true;
}else{
alert('you must agree to the disclaimer in order to save');
return false;
}
}
I then set the 'onclick' attribute of the asp:button to use the function.
This works fine until the radAjax control is used, then the callback is not fired.
I tried using the RadAjax example in the help file but find that the documentation is incorrect for version 2008.1.528.20 as the documentation refers to the "OnRequestStart" event but the control uses "ClientEvents-OnRequestStart".
Also the statement to get the clientid of the control that fired the ajax request is
var eventTarget = eventArgs.EventTarget;
which is wrong and happens to be
var
eventTarget = eventArgs.get_eventTarget();
The button I am using has an ID of "cmdSave" and is in the container of a master form. This means the clientID of the control obtained by using
<%= cmdSave.ClientID %> produces ctl00_ContentPlaceHolder1_cmdSave
while the clientID returned from eventArgs.get_eventTarget(); is
ctl00$ContentPlaceHolder1$cmdSave.
I would suggest that the help section on RadAjax needs to be rewritten and especially with client side validation.
Could you please tell me how I can run my simple javascript function as described above.
Regards