I’m controlling the colProp required value in the beforeShowForm function and its working fine. My problem is the formoptions:{elmprefix:"*"} does not take effect.
Am I doing something wrong? Is there another way to do it?
My code snippet is this
$grid2.jqGrid('navGrid', '#pager',
{ edit:true, add:true, del:true, search:false, view:true, cloneToTop:true},
{ // edit options
beforeShowForm: function(form) {
$("#list").setColProp('Done_Date',
{editrules:{required:true}, formoptions:{elmprefix:"*"}});
$("#list").setColProp('Outcome',
{editrules:{required:true}, formoptions:{elmprefix:"*"}});
},
editCaption:"Edit Record",
edittext:"Edit",
closeOnEscape:true,
savekey: [true,13],
errorTextFormat:commonError,
width:"550",
reloadAfterSubmit:true,
bottominfo:"Fields marked with (*) are required",
top:"60",
left:"70",
closeAfterEdit:false
},
Thanks in advance
Mark
The you should use beforeInitData instead of
beforeShowFormto be able to changeelmprefixsetting on the fly during creating of the form. Additionally you should use recreateForm: true property.I would recommend you to read the post which describes how to format the code inside of the question.