Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello support team,


                                    we have following problem when using new form layout control in a Html.BeginForm.

                                    If we want to have the client side validation for the fom controls (this are DevExpress text controls) like in the following example:

                                    [ASPx]
                                    @{ Html.EnableClientValidation(); } @using (Html.BeginForm("EditCustomerAddress", "Customer", new {id = 1}, FormMethod.Post, new {@class = "aui"})) { @Html.AntiForgeryToken() <label>Customer</label> @Html.DevExpress().TextBoxFor(c => c.Name, settings => { settings.ShowModelErrors = true; settings.Width = 200; settings.Properties.ValidationSettings.ErrorTextPosition = ErrorTextPosition.Right; settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText; }).GetHtml() @Html.DevExpress().Button( settings => { settings.Name = "btnSend2"; settings.Text = @ViewRes.Customer.CommandSave; settings.UseSubmitBehavior = true; }).GetHtml() }


                                    then it works fine. The form does NOT submit to controller and error messages are showing as expected.

                                    Now, if we want to use the new form layout for positioning the controls, the validation still works, but the form submits despite errors to controller .

                                    the code used to layout controls--->
                                    [ASPx]
                                    @{ Html.EnableClientValidation(); } @using (Html.BeginForm("EditCustomerAddress", "Customer", new {id = 1}, FormMethod.Post, new {@class = "aui"})) { @Html.DevExpress().FormLayout(settings => { settings.Name = "formLayout"; settings.AlignItemCaptionsInAllGroups = true; var addressGroupItem = settings.Items.AddGroupItem(itemSettings => { itemSettings.Caption = ViewRes.Customer.TabpageAdresseHeadline; itemSettings.GroupBoxDecoration = GroupBoxDecoration.HeadingLine; }); Action<MVCxFormLayoutItem> textBoxSettingsMethod = (item) => { item.NestedExtensionType = FormLayoutNestedExtensionItemType.TextBox; var tbSettings = (TextBoxSettings)item.NestedExtensionSettings; tbSettings.Properties.ValidationSettings.ErrorTextPosition = ErrorTextPosition.Right; tbSettings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText; tbSettings.ShowModelErrors = true; item.NestedExtensionSettings.Width = Unit.Pixel(370); }; addressGroupItem.Items.Add(e => e.Name, textBoxSettingsMethod); addressGroupItem.Items.Add(e => e.Telefon, set => { set.Caption = @ViewRes.Customer.LabelFon; set.NestedExtensionSettings.Width = Unit.Pixel(370); }); addressGroupItem.Items.Add(e => e.Fax, set => { set.Caption = @ViewRes.Customer.LabelFax; set.NestedExtensionSettings.Width = Unit.Pixel(370); }); settings.Items.Add(itemSettings => { itemSettings.ShowCaption = DefaultBoolean.False; itemSettings.HorizontalAlign = FormLayoutHorizontalAlign.Right; itemSettings.Width = 150; itemSettings.NestedExtensionType = FormLayoutNestedExtensionItemType.Button; var btnSettings = (ButtonSettings) itemSettings.NestedExtensionSettings; btnSettings.Name = "applyButtonCustomer"; btnSettings.Text = @ViewRes.Customer.CommandAenderungenSpeichern; btnSettings.UseSubmitBehavior = true; }); }).GetHtml() }
                                    Thanks in advance

                                    Alexander

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello Alexander,

                                We are aware of this issue. In fact, it was already fixed in the context of the FormLayout - Unobtrusive validation doesn't work for automatically created items ticket. I suggest that you download the hotfix from that ticket.

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners