Current filter:
                                You should refresh the page.
                                  • Having some difficulty with form validation in a partial view within a popup. If my understanding is correct returning the viewmodel to the form is how the user can be informed of the error(s) made in filling it out. However, our system can’t redirect to a partial view alone, nor can it return a partial view as an action result. Is there a way to show the validation errors without redirecting/refreshing/or going to a “new” page? Perhaps updating the form's data?
                                    Thank you for your time, I hope at least some of the following helps,


                                    [HttpPost] [ValidateAntiForgeryToken] public ActionResult CreateTicket(TicketViewModel ticketviewmodel) { if (!ModelState.IsValid) { return PartialView(PartialViewName, ticketviewmodel); } //else //Save to DB //Redirect to the page the button for the popup }


                                    Main Page:

                                    @(Html.DevExtreme().Popup() .ID("newticket-popup") .ContentTemplate(new TemplateName("CreateTicket")) ) @using (Html.DevExtreme().NamedTemplate("CreateTicket")) { @using (Html.BeginForm("CreateTicket", "Tickets")) { using (Html.DevExtreme().ValidationGroup()) { @Html.AntiForgeryToken() @(Html.DevExtreme().Form<TicketViewModel>() .Items(items => { items.AddGroup() .Items(groupItems => { //form stuff groupItems.AddButton() .HorizontalAlignment(HorizontalAlignment.Center) .ButtonOptions(b => b.Text("Create Ticket") .Type(ButtonType.Success) .UseSubmitBehavior(true)); }); }) ) } } }


                                • Customer54547 01.11.2019

                                  Apologies for leaving it out of the original but the form does have the "ShowValidationSummary" property set to true.

                                1 Solution

                                Creation Date Importance Sort by


                                dxForm is a client-side control. So, it validates values on the client side if validation attributes are assigned to your model properties. See the Form - Validation demo. If you wish to send data to the server, you can handle the button's onClick event, get form data using the dxForm.formData option, and send this data to the server using an AJAX call. Then, display errors based on your requirements using, for example, standalone HTML elements.