I have the following code which is styled after the example at the following link:http://phpgrid.com/example/custom-data-validation/
I am using their phpgrid component and need to have custom rules which are constructed in this manner:
$dg -> set_col_customrule(colname,function);
And this is what I have:
$dg -> set_col_customrule("Email","chkemail");
Making a long story short, my javascript would not work although phpgrid support assured me that my javascript worked fine for them, it still would not catch the email errors. So, after some research, I discovered that I need to code it differently because of the ondomready event.
But my function keeps giving me the error of:
Parse error: syntax error, unexpected '(', expecting variable (T_VARIABLE) or '$' in C:\wamp\www\Enterprise\alldisplay.php on line 193
I wasn't real sure where to locate the code in my PHP page, so I have in before my other PHP functions. It's purpose is to capture errors via the custom rule setting.
$(document).ready(function chkemail(value,colname){
alert('am at checking email');
alert('Data..' + colname);
alert('Length..' + length);
if ((jQuery('#Email').length()) === 0) {
return [false, "You must enter at least one Email Address."];
} else {
return [true, ""];
}
});
Any help appreciated ...