This is a migrated thread and some comments may be shown as answers.

AdvanceEditTemplate:Client side validation for overlap appointments

1 Answer 38 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Yelena
Top achievements
Rank 1
Yelena asked on 10 May 2013, 08:41 PM
I use default Advanced/Insert Template.   I would like to do validation for overlap appointments before the postback on the client side.So i try to re-use the code for the LinkButton RadConfirm example.
On the FormCreated event I added OnClientClick event for InsertButton
if (e.Container.Mode == SchedulerFormMode.AdvancedInsert) {
    LinkButton formButton = e.Container.FindControl("InsertButton") as LinkButton;
    if (formButton != null)
    {
        formButton.OnClientClick = "confirmLinkButton(this);  return false;";
    }
}
and in my Javascript I added
function confirmLinkButton(button) {
    try {
        alert("confirmLinkButton");
    function linkButtonCallbackFn(arg) {
        if (arg) {
           eval(button.href);
        }
   }
//   RadConfirm(insertOverlapMessage, linkButtonCallbackFn, 330, 180, null, "Confirm");
   var confirmReturn = confirm(insertOverlapMessage);
   if (confirmReturn) { eval(button.href); }
 
     
} catch (e) {
    alert(" confirmLinkButton: Error Description: " + e.Description + " Error message:" + e.message);
}
}


BUT  my javascript function never been call and it is really inconvenient to use RadConfirm on the server side after postback :  all data from the insert form have been disappeared.

Please, advice how I can make the code to work.  Thank you for your help!

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 15 May 2013, 01:47 PM
Hello,

 
You can achieve it with jQuery as for example in the code below:

function OnClientFormCreated(scheduler, args) {
               var $ = $telerik.$;
               $(".rsAdvEditSave").bind({
                   click: function () {
                       if (contition) {
                           return false;
                       }
                   }
               });
           }

Hope this will be helpful.

Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Yelena
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or