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

Validation problems with form inside Window

1 Answer 363 Views
Window
This is a migrated thread and some comments may be shown as answers.
AspenSquare
Top achievements
Rank 1
AspenSquare asked on 07 May 2013, 05:48 PM
I have a kendo grid with a custom toolbar template that has a button to open a kendo window.

This is the code I use to open my window when the above mentioned button is clicked:
var openAssetEditor = function (e) {
             
            var window = $('#AssetEditorPopUp').data("kendoWindow");
 
            window.wrapper.css({
                height: 450
            });
 
            window.refresh({
                url: "/Asset/AssetPopup",
                data: { assetId: 0 }
            });
 
            window.center();
            window.open();
        };


Right below the grid I have my Window:

@(Html.Kendo().Window()
          .Name("AssetEditorPopUp")
          .Title("Asset Editor")
          .Content("loading asset info...")
          .Draggable(true)
          .Modal(true)
          .Visible(false)
          .Width(950)
      )

My controller for the Popup window:

public ActionResult AssetPopup([DataSourceRequest] DataSourceRequest request, int? assetId)
        {
            return PartialView("~/Views/Asset/AssetPopup.cshtml");
        }

I can't seem to validate the form. I always get back that the form is valid even if all the fields are left blank.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 May 2013, 12:19 PM
Hello Eric,

If you are using the jQuery validation then you should use the jQuery.validator.unobtrusive.parse method in the Window refresh event after the content has been loaded:

function refresh(e) {
    $.validator.unobtrusive.parse(this.element);
}
If you are using the Kendo Validator then you should initialize it on the form. 

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
AspenSquare
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or