excuse me guys, but i'm having these two problems. i hope you guys can help me with this.
here is part of my code
jQuery("#VWWMODULE").jqGrid(
{
url:'loadstatic.php?q=2&t=CORE_VW_WMODULE',
datatype: "json",
mtype: "POST",
colNames:['Id', 'From Range', 'To Range'],
colModel:
[
{
name:'id',
index:'id',
width:7,
editable:true,
edittype:'text',
editrules:{required:true},
editoptions:{maxlength:7, size:7},
formoptions:{rowpos:1, elmprefix:' '},
key:true
},
{
name:'rangefrom',
index:'rangefrom',
width:7,
editable:true,
edittype:'text',
editrules:{required:true, number:true},
editoptions:{maxlength:7, size:7},
formoptions:{rowpos:6, elmprefix:' '}
},
{
name:'rangeto',
index:'rangeto',
width:7,
editable:true,
edittype:'text',
editrules:{required:true, number:true, custom:true, custom_func:frtid},
editoptions:{maxlength:7, size:7},
formoptions:{rowpos:7,elmprefix:' '}
}
]
as you can see in the 'rangeto' i'm having a custom validation. this validation is simple actually. it just needs to check whether the value of 'rangeto' that we input is greater than the value of 'rangefrom'. now how can i get the value from 'rangefrom' so i can compare it with value from 'rangeto' in the custom validation function?
for my second question is about index 'id'. it used as a primary key for a table. so it shouldn't be changed when in editing mode. i'm saying when in add mode, a user can input it anyway he want. but once he submit it, the value can't be changed. in edit mode, the user can still see the 'id' value but he can't change it because it is ineditable. how can this be done?
EDIT
okay, now i'm having another problem. this is a simple question though.
- how to make the custom validation function called just when in add mode? cause my function will gives error message when in edit mode when it should not be called
can any of you guys please help me with these 3 problems that i had?
EDIT
solved with some more explanation from here