Bulk Edit Custom Validation

QuestionsBulk Edit Custom Validation
Richard Samson asked 3 months ago

I currently have a select (drop down) column validated so users are forced to select an option when editing and adding records:

$col[“editrules”] = array(“custom”=>true,”custom_func”=>”function(value,label){return dropdown_validation(value,label);}”);


This uses the Javascript code:

function dropdown_validation(value, label) {
if(value.length > 0) {
return [true,””];
} else {
return [false, label+” field must be selected”];


This works fine for single record edits, but while bulk editing the validation code is still triggered for fields that don’t need changing during the bulk edit.


Is there an easy way of modifying the above to only trigger during bulk editing if ” – Empty – ” has been selected in the respective field?



2 Answers
Richard Samson answered 3 months ago

After a bit of trial and error I’ve managed to create a usable solution, probably not the best but basically involves checking the dialog title to determine if it’s the bulk editor or not.

function dropdown_validation(value, label, bulkeditcount) {
if(jQuery("#edithdlist1").find("span").text() != "Bulk Edit"){
if(value.length > 0) {
return [true,""];
} else {
return [false, label+" field must be selected"];
} else {
if(value != "-"){
return [true,""];
} else {
return [false, label+" field is required"];

Abu Ghufran Staff answered 3 months ago

Thanks for sharing. For others, here ‘edithdlist1’ … list1 is your grid id being set in render(“list1”).

One other simple options was to create 2 columns with same name. Show one for normal operations but hidden on bulk edit. And other hidden for normal operations and shown for bulk edit.

With each column you can set them true/false accordingly.

$col[“show”] = array(“list”=>true, “add”=>true, “edit”=>true, “view”=>true, “bulkedit”=>true);

Abu Ghufran - Dev Team
PHP Grid Framework
Your Answer

17 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!