AdvanceEditTemplate:Client side validation for overlap appointments

2 posts, 0 answers
  1. Yelena
    Yelena avatar
    14 posts
    Member since:
    Jan 2013

    Posted 10 May 2013 Link to this post

    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!
  2. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 15 May 2013 Link to this post

    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.
Back to Top