Home › Forums › Guriddo jqGrid JS › Help › Help : Required input field
Hi,
I've made a 2 column grid.
My colModel is defined like this.
Hello,
Currently this option works only on field of type text and textarea.
Regards
Tony
tony said:
Hello,
Currently this option works only on field of type text and textarea.
Regards
Tony
Ok,
with this code it gives me an error message on the second field?Is it normal?
{name:'idCustomer', index:'CUSTOMER_ID',editable:true,edittype:"text",editrules:{required:true},width:115},
What of error?
What is the error message?
I put the required option on the 2 column.
When I add a row with an empty form, I got the reqired field message for the second colum an not for the first one.
To have idea please post the entry jqGridl array – I recommend to
make copy paste here.
Please use the latest release of jqGrid
Ok so I made something like this
$(”#listCustomers”).jqGrid({
url:'include/gridCustomers.php?&nd='+new Date().getTime(),
editurl:'include/gridCustomers.php?&nd='+new Date().getTime(),
datatype: 'json',
colNames:['Customerno','Customername','Company Group','Adress','City','Country','Language','Product','Format','Category','Keycustomer'],
colModel :[
{name:'idCustomer', index:'CUSTOMER_ID',editable:true,edittype:"text",editrules:{required:true},width:115},
{name:'name', index:'NAME',editable:true,edittype:"text",editrules:{required:true},width:170} ,
{name:'idCompany', index:'COMPANY_ID',editable:true,edittype:"select",editoptions:{value:'0:'},editrules:{required:true,number:true,minvalue:1},width:140},
{name:'adress', index:'ADRESS',editable:true,edittype:"text",editrules:{required:true},width:210} ,
{name:'city', index:'CITY',editable:true,edittype:"text",editrules:{required:true}},
{name:'idCountry', index:'COUNTRY_ID',editable:true,edittype:"select",editoptions:{value:'0:;3:Belgium;2:Canada;4:Holland;13:Ivory Coast;1:Mexico'},editrules:{required:true},width:100},
{name:'idLanguage', index:'LANGUAGE_ID',editable:true,edittype:"select",editoptions:{value:'0:'},editrules:{required:true},width:100} ,
{name:'idProduct', index:'PRODUCT_TYPE_ID',editable:true,edittype:"select",editoptions:{value:'0:'},editrules:{required:true},width:80},
{name:'idFormat', index:'FORMAT_ID',editable:true,edittype:"select",editoptions:{value:'0:'},editrules:{required:true},width:80},
{name:'idCategory', index:'CATEGORY_ID',editable:true,edittype:"select",editoptions:{value:'0:'},editrules:{required:true},width:90},
{name:'keyCustomer', index:'KEYCUSTOMER',hidden:true,editable:true,editrules:{edithidden:true}, edittype:"checkbox",editoptions:{value:'1:0'}}],
pager: $('#pagerCustomers'),
recordtext: 'customers',
shrinkToFit:true,
width:900,
height:230,
rowNum:10,
rowList:[10,20,30],
sortname: 'NAME',
sortorder: “desc”,
viewrecords: true,
imgpath: 'design/themes/basic/images',
shrinkToFit:true
})
As you can see “idCustomer” and “name” are required.When i fill my form and put nothing in each of these field I got this message :
Customername: Field is required
Normally I should havethis message first no?
Customerno: Field is required
I have jdGrid 2.3.1
Thanks,
It is a bug. It is corrected.
TO work this open grid.formedit.js and find function checkValues
Replace:
I've modified the file, but nothing change

Be a sure that you use the development version, but not min.
It should work. Also clear the cache
I've set the 'minver' variable
Ok,
the problem has been solved.
It seems that the editrules works from the second column of the colmodel.
So i add an non editable column in my colmodel at the first position and it works now
I do not think so. This is a bug.
Also I think that there is a cashe that is not cleared.
Please clear the cache, switch to development version and try
Regards
Tony
How to switch to developpement version?
Clear all the cache and
var minver = false;
Reagrds
Tony
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top