i create a custom button as shown below, next I want the button1 to be dimmed if from the dataset got content text of "Error" inside "TRIGGER" field. can someone help to provide the complete code?
i create this complete script but, the button1 still not dimmed;
// Page Render event
function Page_Render()
{
$options = &$this->OtherOptions;
// Create my_custom_button
$option = &$options["action"];
$item = &$option->add("my_custom_button");
$item->Body = "<a class=\"ew-action\" title=\"Clear All Data\" data-caption=\"Clear All Data\" href=\"custom\\reset_sd_import_non_kcb2_inline.php\">Clear All Data</a>";
$item->Visible = TRUE;
// Create my_custom_button1
$option = &$options["action"];
$item = &$option->add("my_custom_button1");
// Check if any row in TRIGGER contains the text 'Error'
$errorCondition = false;
foreach ($this->data as $row) {
// Assuming TRIGGER is the correct field name, adjust it if needed
$triggerContent = $row['TRIGGER'];
// Check if the TRIGGER field contains the exact text 'Error' (case-insensitive)
if (strcasecmp($triggerContent, 'Error') === 0) {
$errorCondition = true;
break;
}
}
// Set the appropriate attributes for my_custom_button1
if ($errorCondition) {
$item->Visible = FALSE;
} else {
$item->Visible = TRUE;
$item->Body = "<a class=\"ew-action\" title=\"Move Data To Permanent Table\" data-caption=\"Move Data To Permanent Table\" href=\"custom\\button_add_data_to_sd_trans_non_kcb_a_inline.php\">Move Data To Permanent Table</a>";
}
}