Custom error messages in jqgrid - jqgrid

How I can display custom error messages for required field and other validations in jqGrid forms.

You can use attr property of the searchoptions to set additional attributes of the input or select element used in the searching toolbar.
UPDATED: In the comment you explained that you means to customize the validation messages. You can ovewride the valuse from $.jgrid.edit.msg (see grid.locale-en.js or other localization files). For example you can use
$.jgrid.edit.msg.required = "is missing";
If you want to make the message more dynamic you can use custom editrule and build the error message inside of custom_func.

Related

Vee-validate - Triggering field level validation only when $validator.validateAll() is called but not when the input field is touched

I have a scenario where a custom field validation rule to be triggered only when the submit button is clicked for that form and it should be triggered by calling $validator.validateAll() function itself. I don't want this rule to be triggered when I start making changes to the input field.
I have looked into .disable directive but looks it it will disable all the validation rules for that field which I don't want. I want to disable a specific validation rule and enable it later on the button click.
I am using vee-validate version 2.xx.
try dynamic validation in vee validate.
Dynamic Rules

Salesforce - Make all fields read-only

I am trying to figure out the best way to make all fields in a custom object read only after a condition is met.
For example. There is a field called Status. If the status is equal to Closed, I want all fields on this custom object to be readonly i.e non editable.
What is the best way to do this? Validation rule, trigger, etc? I would really appreciate examples. Thanks
In short: With a workflow you could change the record type, for that record type you can assign a page layout which is read only.
Add a trigger to the custom object
Open custom object, click on the "Field Label" of one Custom Field, when it opens, create a new "Validation Rule" that checks the status and displays an error message

Kendo Ui Form Validation: Use field title in validation message

I am using Kendo Popup grid and notice that the validation message for all the fields that are set to required appear as "{field} is required". I want to be able to use the "Title" field of the model instaed of the fieldname. Is there an easy way for this?
As per Kendo forum http://demos.kendoui.com/web/validator/index.html : I need to specify the error message individually for all the fields which is not a good solution(IMHO).
Currently this is not supported out of the box. You need to set the validation message via the validationMessage attribute.

ASP.NET MVC 3: client-side validation message sticks around afterward if target field disabled

I have a form that has a field (Field A) that needs to be empty if Option 1 is selected on a dropdown, and is required if Option 2 is selected. I have some javascript that clears and disables the Field A when Option 1 is selected.
I have Simon Ince's RequiredIf attribute applied to Field A in the model, dependant on Option 1, and it works well. That's not the problem.
Here's the sequence of events that does cause a problem:
User has Option 2 selected (so that field A is required) and Field A empty.
User clicks on Save. Validation message appears by field A and in the validation summary. All is well.
User changes to Option 1. Field A becomes disabled.
User clicks on Save. Validation message remains by Field A but does not appear in the Validation Summary.
I conclude from this that the RequiredIf validation is working (and Field A is passing validation), but the old validation message is sticking around. Which I do not want.
All this is client-side, by the way.
If the field isn't disabled, everything works as expected, but I'd like it disabled rather than editable but "required to be empty".
Other than clear out the message SPAN tag through js and jQuery, is there a way to fix this?
Because the validation requirements are changing, you need to cause validation to occur, and then update all of the error messages. Since the issue relates to the change of the selected item on the dropdownlist, add the following:
$("#myDropDown").live("change", function() { // assumes dropdownlist has id of 'myDropDown'
$("form").validate().form(); // form() causes error messages to update
});

Struts2 validation and Select tag

I'm using struts2 and validation using annotations in the action. I do use another action to fill the select lists when i fill the form with missing data it returns to the input result of the action but with the missing list and shows me an error.
See the FAQ entry about repopulating form controls when validation fails.
The nutshell version is that if you have lists they need to be repopulated using either the Preparable interface or with <s:action> tags. Personally, I think Preparable is the way to go.

Resources