This question is locked. New answers and comments are not allowed.
Hello,
I had created partial view and load it in window control through ajax call.
It fires validation in mozila but not in IE ( Problem-1) as well,
Inside this partial view I am having Telerik Autocomplete Control.
But validation doesn't work for this field even inside window control and normal page without window control(Problem-2).
I had loaded Js files:
query.validate.min.js
jquery.validate.unobtrusive.min.js
telerik.autocomplete.min.js
telerik.list.min.js
MicrosoftAjax.js
MicrosoftMvcAjax.js
MicrosoftMvcValidation.js
In this sequense only.
@(Html.Telerik().AutoCompleteFor(m => m.JobTitleDescription)
.Name("JobTitleDescription")
.BindTo(ViewData["lstJobtitle"] as List<string>)
.HighlightFirstMatch(true)
.AutoFill(true)
.HtmlAttributes(new { @class = "tbox readonly" })
)
@Html.ValidationMessageFor(mbox=>mbox.JobTitleDescription)
Is there anything wrong with my code?
I had created partial view and load it in window control through ajax call.
It fires validation in mozila but not in IE ( Problem-1) as well,
Inside this partial view I am having Telerik Autocomplete Control.
But validation doesn't work for this field even inside window control and normal page without window control(Problem-2).
I had loaded Js files:
query.validate.min.js
jquery.validate.unobtrusive.min.js
telerik.autocomplete.min.js
telerik.list.min.js
MicrosoftAjax.js
MicrosoftMvcAjax.js
MicrosoftMvcValidation.js
In this sequense only.
@(Html.Telerik().AutoCompleteFor(m => m.JobTitleDescription)
.Name("JobTitleDescription")
.BindTo(ViewData["lstJobtitle"] as List<string>)
.HighlightFirstMatch(true)
.AutoFill(true)
.HtmlAttributes(new { @class = "tbox readonly" })
)
@Html.ValidationMessageFor(mbox=>mbox.JobTitleDescription)
Is there anything wrong with my code?
7 Answers, 1 is accepted
0
Priyanka
Top achievements
Rank 1
answered on 15 Mar 2011, 07:25 AM
I found solution
@(Html.Telerik().AutoCompleteFor(m => m.JobTitleDescription)
.Name("JobTitleDescription")
.BindTo(ViewData["lstJobtitle"] as List<string>)
.HighlightFirstMatch(true)
.AutoFill(true)
.HtmlAttributes(new { @class = "tbox readonly" ,@value="Text1" } )
)
@(Html.Telerik().AutoCompleteFor(m => m.JobTitleDescription)
.Name("JobTitleDescription")
.BindTo(ViewData["lstJobtitle"] as List<string>)
.HighlightFirstMatch(true)
.AutoFill(true)
.HtmlAttributes(new { @class = "tbox readonly" ,@value="Text1" } )
)
0
Guilherme
Top achievements
Rank 1
answered on 04 Apr 2011, 02:13 PM
Hello!
I have a different issue with validation inside window.
See the code bellow:
Both of fields are required.
I put this code inside an user control and when I call it as a partial view the validation works, but when i call it with a window using LoadContentFrom the validation doesn't work.
Anyone have a solution for this situation?
Thanks
Guilherme Moschen
I have a different issue with validation inside window.
See the code bellow:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MvcApplicationExample.Models.ValidationModel>" %><% using (Html.BeginForm("Validation", "Home")) { %> <%= Html.ValidationSummary() %> <label for="Age">Age</label><br /> <%= Html.TextBoxFor(x => x.Age) %><br /> <br /> <label for="Name">Name</label><br /> <%= Html.TextBoxFor(x => x.Name)%><br /> <br /> <input type="submit" name="go" value="Submit" /><% } %><% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group .Add("jquery.validate.js") .Add("jquery.validate.unobtrusive.js") ); %>Both of fields are required.
I put this code inside an user control and when I call it as a partial view the validation works, but when i call it with a window using LoadContentFrom the validation doesn't work.
Anyone have a solution for this situation?
Thanks
Guilherme Moschen
0
Hello Guilherme,
Atanas Korchev
the Telerik team
Try including the validation JavaScript files in the view which contains the window. The ScriptRegisrar is not capable of registering JavaScript files defined in partial views which are loaded through Ajax.
Greetings,Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Guilherme
Top achievements
Rank 1
answered on 04 Apr 2011, 06:11 PM
Thanks to reply Atanas, but didn't work :(
I put the issue on a isolated project, so you can look appropriately.
For some reason any client (javascript) validations doesn't inside a Telerik Window.
Thanks
Guilherme Moschen
I put the issue on a isolated project, so you can look appropriately.
For some reason any client (javascript) validations doesn't inside a Telerik Window.
Thanks
Guilherme Moschen
0
Hello Guilherme,
Best wishes,
Hristo Germanov
the Telerik team
As Atanas mentioned, LoadContentFrom loads "FormValidation" with ajax.
If you load your partial view with RenderPartial inside window Content the validation will work correctly:
<% Html.Telerik().Window() //add stored article window .Name("ValidationForm") .Title("Store Article to Location") .Content(() => { %> <% Html.RenderPartial("FormValidation"); %> <% }) .Buttons(buttons => buttons.Refresh().Close()) .Modal(true) .Visible(false) .Resizable() .Render(); %>Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
nachid
Top achievements
Rank 1
answered on 05 Apr 2011, 02:42 PM
You need to explicitly reapply validation by calling this :
if (jQuery.validator !== undefined) jQuery.validator.unobtrusive.parse('form');0
Guilherme
Top achievements
Rank 1
answered on 05 Apr 2011, 07:01 PM
Sirs, works! Thanks a lot!
I understood the difference, the content of window isn't loaded by AJAX, so on event onLoad of the View all the content is already there and the validation can run completely.
And the regarding the javascript call mentioned by Nachid works as well, but I prefer the first one, I just don't need to put any other code.
Thanks for the help.
Guilherme Moschen
I understood the difference, the content of window isn't loaded by AJAX, so on event onLoad of the View all the content is already there and the validation can run completely.
And the regarding the javascript call mentioned by Nachid works as well, but I prefer the first one, I just don't need to put any other code.
Thanks for the help.
Guilherme Moschen