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

Custom create/edit form

7 Answers 442 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 29 Aug 2013, 09:44 AM
Hello,

what is the best practises way to use custom forms for create and edit my events? I don't want use templates becouse I would like to use custom validation and dedesign of edit forms. If I call e.preventDefault() in edit function, scheduler returns error after second opening create form by double click in scheduler... 

cancelEvent() function isn't  too much elegant...

Any other possibilities?

Thanks David

7 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 02 Sep 2013, 09:03 AM
Hi David,

 
In current scenario I would suggest to define the custom validation rules inside the model definition and use editor template:

schema: {
    model: {
        id: "Id",
        fields: {
            Id: {
                //this field will not be editable (default value is true)
                    editable: false,
                // a defaultValue will not be assigned (default value is false)
                    nullable: true
            },
            description: {
                //set validation rules
                validation: {
                    required: true,
                    //custom validation rule:
                    custom: function (input, params) {
                        if (input.is("[name='description']")) {
                            if (input.val() == undefined || input.val().length <= 0) {
                                return false;
                            }
                        }
                        //check for the rule attribute
                        return true;
                    }
                }
            },
Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 09 Sep 2013, 01:09 PM
Hello Vladimir,

thanks for reply but I really need use my windows, forms and server validations. Now I'm using edit function in scheduler options call this.cancelEvent() and open my window but before I call this method kendo window is displayed. It isn't too much nice... Is better solution exists?

Thanks David
0
Vladimir Iliev
Telerik team
answered on 11 Sep 2013, 08:08 AM
Hi David,

 
In case you need to use another popup with custom form for editing events then you should implement a custom solution which to prevent the opening of the build-in popUp editor (you can use the edit event). Then you can open your custom window and finally use the scheduler API to save the new values (or post them to the server).

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jsn
Top achievements
Rank 1
answered on 11 Sep 2013, 09:24 AM
Hi David,

I also had this problem a days ago,. when you use e.preventDefault() inside edit event the scheduler window will not show up but on the second time
 you double click to add new schedule events, edit will never get fired.. So, what I did is hide the scheduler window by adding  the style attribute to the "k-window" to "visibility:hidden!important"  inside the edit event.. Here's the code snippet.


edit: function (e) {
           $('.k-window').attr("style", "visibility:hidden!important");
           // add your code here to show your custom form.
}



 Hope this help..

Regards,
Jesson
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Sep 2013, 09:48 AM
Hello Jesson,

 
The described problem is caused by a JavaScript error thrown on second attempt to edit event. This issue is addressed in the latest internal build available only to paid license holders.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 11 Sep 2013, 10:22 AM
Hi Jasson,

thanks. I solved this problem similarly like you but if you need cancel editing because user hasn't permission to edit is better use preventDefault. Like Georgi Krustev wrote, there is a bug in version  v2013.2.716. Downloading last internal build solves my problem with this bug...

Regards
-David 
0
Jsn
Top achievements
Rank 1
answered on 11 Sep 2013, 10:38 AM
oh, I see.. Thanks for the info. By the way I was using the trial version of kendo UI for now.. I'll have it a try as soon as I got the paid license..
Tags
Scheduler
Asked by
David
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
David
Top achievements
Rank 1
Jsn
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or