Forum
I'm trying to perform a custum_funk validation on one filed during ADD.
But this function should not work the same way during EDIT.
Is there a way to tell if I'm performing an ADD or an EDIT to the javascript?
This is the line that sets the parameters for the edit on the field "fld_Email":
This is where the navigatorbuttons are defined:
{reloadAfterSubmit:true, closeAfterAdd:true, modal:true, width:300}, // add options
I just want to know if it is EDIT or ADD and send a variable to the function… is that possible?
Here ist the function I use for validation:
var a = '';
$.ajax({
type: "POST",
async: false,
url: "users_checkmail.php",
data: {fld_Email:value},
dataType: "HTML",
error: function(){
a = [false,"Could not contact the server!",""];
},
success: function(msg){
if(msg == 1){
a = [false,"You must set an e-mail!",""];
}else if(msg == 2){
a = [false,"Your e-mail is not correct",""];
}else if(msg == 3){
a = [false,"Your e-mail is allredy in the system",""];
}else if(msg == 4){
a = [true,""];
}
}
});
return a;
}
Best regards
Fredrik
17:50
Moderators
30/10/2007
Hello,
This is not documented, but.
1. When we create the form we set a id of the form like this FrmGrid_ + the id of the grid
2. When we create a form we create a hidden column with a only td element with hidden input element with id = id_g. In this element we store the id of the edited row.
3. When we are in add mode this id is set to "_empty"
So short your code should look like this if your grid has id = mygrid.
function checkMail(value){
var mode = $("#id_g","#FrmGrid_mygrid").val();
if(mode == "_empty") {
// we are in add mode
} else {
// we are in edit mode
}
...
}
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:
29 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