Forum


12:53

02/12/2009

Hello Tony,
First of all, thanks for your help about CSS trouble with modal dialog box, I hope you can solve it soon.
Now I'm going further and try to add some datas in my database with add modal box.
I saved my datas and that's fine.
My question is about how to validate datas before updating db :
[Image Can Not Be Found]
I would like to test if the 'code client' filled '44a' already exists in the db, in this case, adding datas cannot be performed and user have to be informed, otherwise I would like to populate 'raison sociale','site' in the row with extracted datas from db, and put 'code client' value in uppercase.
Here is my code for this field :
editable:true,
edittype:"text",
editoptions:{
readonly:false,size:5,maxlength:5
},
formoptions:{
label:"Code client", elmprefix:"<font color='red'> * </font>"
},
editrules:{required:true,custom:true,custom_func:mycheck}
}
and the test function :
switch(colname){
case "Code client":
if(value > "") {
$("#code").val()=value.toUpperCase();
return [true,"OK",""];
}
break;
default:
return [false,"Code CLIENT erroné",""];
}
}
I think that I have to put some code in this function for accessing db and extract fields values, but I don't know how to address row cols with these values.
And the last point, how to avoid to have added row when 'code clt' already exists in database ?
I have read many chapters in wiki without finding any way to progress. Sorry to disturb you in your great job.
I hope you will give me some way to continue.
Have a nice day and a good we.
Best regards
Jihel
21:13

Moderators
30/10/2007

Hello,
IMHO this is not jqGrid problem. We have a wide range of events to do what you want, but we do not have a solutions on how you will check if the record exists in the database.
Instead maybe you will use ajax in mycheck function to determine if the record exists in the DB. The more important part here is that you need to use ajax with async option set to false.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
35 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66