Custom error message in search box jqgrid - jqgrid

I want to display a custom error message if the search field is empty. Please tell me how can I do it.

If I understand you correctly you can use searchrules inside of colModel. For example
searchrules: {required: true}

Related

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.

Post non editable values in jqGrid?

I'm using jqGrid, and I would like to post non editable values to the server. I'm editing row by row (not form). Is that possible?
The column is visible, and I'm using inline editing. The data is posted using "editurl" property of the grid.
** Solution **
I solved it in a completely different way, by not using jqGrids setCell, but instead setting the textbox value using document.getElementById(selr + "_Verksamhetskod").value = data.
Not exactly what I had in mind initially, but it works...
Just add that to your cell configuration:
editable: true, editoptions: {disabled: true}
Well if I'm understanding correctly you are trying to make a cell become read-only once it has a value but still be in a format where you can post to the server correctly.
You could use Jquery to place a read-only attribute on each input field
$("#PrimaryKey".columnName").attr("disabled", true)
and either fire this code if there is a value in the input field or after an input has been entered.

jqGrid with my custom search

I every one i need to something like as shown in the attachment
Can any one help me out. I dont want to use tool bar search and default search of jqgrid.
Thanks.
If I understand correct your question you can solve your problem by adding searchoptions to the colModel item which corresponds "Related To" column. The searchoptions should has sopt property with the operations which you need to allow for the column. For example
searchoptions: { sopt: ['eq', 'cn'] }

jqGrid hide a field

I am new to jqGrid, and having trouble with achieving a couple of tasks. Any guidance will be a huge help.
I have a field (CREATE_DATE) whose value needs to be passed in the edit form. To achieve this I have to make it editable, but at the same time I don't want it to display in the edit form. Something similar to this issue (http://stackoverflow.com/questions/2368051/jqgrid-how-to-have-hidden-fields-in-an-edit-form) Something like this is what I want to achieve.
$('#CREATE_DATE_id]').attr('type', 'hidden');
Thanks a lot.
If you have some hidden column in the grid and you want to send the value only during the row editing you should include in the definition of the column the following properties:
editable: true, hidden: true, hidedlg: true, editrules: { edithidden: true }
If you want to display the column in the grid and need to send the data to the server, but you just don't want to display the data in the edit form you can mark the column as editable: true, but hide the field inside of beforeShowForm callback. You can even implement different behavior in Add and in Edit forms. See the answer for more details.

Custom error messages in 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.

Resources