Hi, I need to hide the button to add, according to the value of a field of its master table. How I can achieve this? all I saw in the forum I have not worked.
I'm using v10 PHPMaker. Any help is welcome. Thank you!
Conditional hide ADD button according to master table row
-
- User
- Posts: 17
Conditional hide ADD button according to master table row
-
- User
- Posts: 17
Hi Danielc, First, thanks for your help. I tested what you tellme and didnt work. i found function setCanAdd(), this can be used in Page Load event, but quit the button ADD. Now, i want run this, according a field value from master table, wich its State. Do you know how can i get this value in the list page, to evaluate this in PageLoad Event and run or not the funcition SetCanAdd??
TKS, Again.-
-
- User
- Posts: 17
Finnally, this works, maybe there are better options, but this work for me:
function Page_Load() {
//echo "Page Load";
//Desabilita agregar si el Estado es distinto a BORRADOR.
$idForm = @$GET["id"];
if (!is_null($idForm)){
$SESSION['id']=$idForm;
$estado = ew_ExecuteScalar("select estado from solicitudes where id='".$idForm."';");
if ($estado == 1) {
Security()->setCanAdd(TRUE);
}else{
Security()->setCanAdd(FALSE);
}
}else{
$estado = ew_ExecuteScalar("select estado from solicitudes where id='".$_SESSION['id']."';");
if ($estado == 1) {
Security()->setCanAdd(TRUE);
}else{
Security()->setCanAdd(FALSE);
}
}
} //event End