Skip to content

Set field required based on another field value using events

Doing things at run-time requires event handler in javascript such as custom data validation and dynamic column property update.

An example is to set mandatory fields based on another field value. The solution is use add_event() method and 'jqGridLoadComplete' event. See this example:
http://phpgrid.com/example/row-level-permission-edit-condtion/

The javascript required to set column property to be required 
// ... your condition ...//
jQuery(”#MYGRID”).setColProp('colname',{editrules:{required:true}}); 

More about jqGrid setColProp method: 
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods

Feedback and Knowledge Base