Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Scheduler / Preventing insert of appointments without specifying subject in the Inline Form

Preventing insert of appointments without specifying subject in the Inline Form

Article Info

Rating: Not rated

Article information

Article relates to

 RadScheduler

Created by

 Veronica, Telerik

Last modified

 11 March, 2011

Last modified by

 Veronica, Telerik


HOW TO

Prevent inserting of appointments when no subject is specified in the Inline Form.



DESCRIPTION

At this moment you are not allowed to create appointments without specifying their subject in the Advanced Form. This is achieved with the help of RequiredFieldValidator in the Advanced Form. However there is no limitation when using the Inline Form.

SOLUTION

The solution is achieved by using JQuery. You'll need to subscribe to the OnClientFormCreated event and use the following code in the handler:

JavaScript:
function OnClientFormCreated(sender, args) {
            var $ = $telerik.$;
            $(".rsAptEditConfirm").bind({
                click: function() {
                    var subject = $('.rsAptEditTextareaWrapper').children();
                    var text = subject.val();
                    if (text == '') {
                        alert('Please insert a subject!');
                        return false;
                    }
                }
            });
        }

RESTRICTIONS:

Please note that if you subscribe to the server-side event OnFormCreated - you need to move the logic in the OnClientFormCreated event in the pageLoad():

function pageLoad() { 
            var $ = $telerik.$; 
            $(".rsAptEditConfirm").bind({ 
                click: function() { 
                    var subject = $('.rsAptEditTextareaWrapper').children(); 
                    var text = subject.val(); 
                    if (text == '') { 
                        alert('Please insert a subject!'); 
                        return false
                    
                
            }); 
        }


Comments

There are no comments yet.
If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.