validationerror

How to update DIV in _Layout.cshtml with message after Ajax form is submitted?

一笑奈何 提交于 2019-12-06 05:38:25
Currently I have a Razor View like this: TotalPaymentsByMonthYear.cshtml @model MyApp.Web.ViewModels.MyViewModel @using (@Ajax.BeginForm("TotalPaymentsByMonthYear", new { reportName = "CreateTotalPaymentsByMonthYearChart" }, new AjaxOptions { UpdateTargetId = "chartimage"})) { <div class="report"> // MyViewModel fields and validation messages... <input type="submit" value="Generate" /> </div> } <div id="chartimage"> @Html.Partial("ValidationSummary") </div> I then display a PartialView that has a @Html.ValidationSummary() in case of validation errors. ReportController.cs public

Custom error message for Laravel validation rule: Dimensions

♀尐吖头ヾ 提交于 2019-12-05 17:46:13
I'm trying to validate an image upload that looks like the following: $this->validate($request, [ 'admin_image'=> 'nullable|image|dimensions:min_width=600,min_height=600', ]); when the selected image too small then laravel shows error: The Admin Image has invalid image dimensiona I think that message is not saying specifically that in which dimension the image small, eg: width or height. I'm expecting error message like: The Admin Image width cannot be less than 600px and The Admin Image height cannot be less than 600px here 'Admin image' is the attribute name & '600' is the value I given in

How to change the Validation Error behaviour for Dropwizard?

谁说胖子不能爱 提交于 2019-12-05 05:17:03
问题 In Dropwizard I use @Valid annotations for my resource methods: public class Address { @NotNull String street ... } @Path("/address") @Produces(MediaType.APPLICATION_JSON) public class AddressResource { @POST public MyResponse addAddress(@Valid Address address) { if (address == null) { throw new WebApplicationException("address was null"); } ... } } On application start I register a custom WebApplicationExceptionMapper which handles WebApplicationExceptions . Thus, for addresses with the

How to change the Validation Error behaviour for Dropwizard?

三世轮回 提交于 2019-12-03 22:15:05
In Dropwizard I use @Valid annotations for my resource methods: public class Address { @NotNull String street ... } @Path("/address") @Produces(MediaType.APPLICATION_JSON) public class AddressResource { @POST public MyResponse addAddress(@Valid Address address) { if (address == null) { throw new WebApplicationException("address was null"); } ... } } On application start I register a custom WebApplicationExceptionMapper which handles WebApplicationExceptions . Thus, for addresses with the value null, the exception is thrown and handled in the mapper which generates a useful response. However,

using f:viewParam with required attribute and commands

人走茶凉 提交于 2019-12-01 05:38:57
I want to share my experience using primefaces, f:viewParam and p:commandButton, and ask a few questions.Take a look at this page: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head></h:head> <h:body> <f:metadata> <f:viewParam required="true" name="id_file" value="#{bean.idFile}" /> </f:metadata> <h:form id="tableform" prependId="false"> <p:commandButton actionListener="#{bean

using f:viewParam with required attribute and commands

China☆狼群 提交于 2019-12-01 02:31:07
问题 I want to share my experience using primefaces, f:viewParam and p:commandButton, and ask a few questions.Take a look at this page: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head></h:head> <h:body> <f:metadata> <f:viewParam required="true" name="id_file" value="#{bean.idFile}" />

How to show validation errors using redirect in codeigniter?

霸气de小男生 提交于 2019-11-30 11:28:29
I have been dealing with a problem for a while. How can I set the validation errors using redirect in a function? This is the code I have in my controller : function send() { $this->form_validation->set_rules('e-mail', 'Email', 'trim|required|valid_email'); $this->form_validation->set_rules('cellphone', 'Cellphone Number', 'trim|required|is_natural'); $this->form_validation->set_message('required', '%s is required.'); $this->form_validation->set_message('valid_email', '%s is not a valid Email Address'); $this->form_validation->set_message('is_natural', '%s can only contain numbers.'); $this-

How to Highlight Fields on Rails Validation Errors

落花浮王杯 提交于 2019-11-30 09:20:45
How do you display form field highlighting for fields that fail validation errors in Rails 3.1? I know that scaffolding automatically generates the css and controller code to handle this, but I was wondering if there was a way to generate that manually. I have already implemented the string display of error messages through: @user.errors.full_messages.each...etc, but I can't get the fields to become highlighted in red. Any ideas? Thanks. Jakub Naliwajek Assuming you have an error class for fields in your CSS file: <% if @user.errors[:name] %> <%= f.label :name, :class => "error" %> <% else %>

How to show validation errors using redirect in codeigniter?

不羁的心 提交于 2019-11-29 17:03:15
问题 I have been dealing with a problem for a while. How can I set the validation errors using redirect in a function? This is the code I have in my controller : function send() { $this->form_validation->set_rules('e-mail', 'Email', 'trim|required|valid_email'); $this->form_validation->set_rules('cellphone', 'Cellphone Number', 'trim|required|is_natural'); $this->form_validation->set_message('required', '%s is required.'); $this->form_validation->set_message('valid_email', '%s is not a valid Email

How to Highlight Fields on Rails Validation Errors

北战南征 提交于 2019-11-29 14:40:51
问题 How do you display form field highlighting for fields that fail validation errors in Rails 3.1? I know that scaffolding automatically generates the css and controller code to handle this, but I was wondering if there was a way to generate that manually. I have already implemented the string display of error messages through: @user.errors.full_messages.each...etc, but I can't get the fields to become highlighted in red. Any ideas? Thanks. 回答1: Assuming you have an error class for fields in