This topic is locked

Hide Edit function based on selected field

3/4/2012 5:40:10 PM
PHPRunner General questions
A
Athlon author

Can someone please advise - What am I doing wrong here. I can hide buttons but can not get rid of the icon edit function.
My code is as follows and works fine with the add new record.
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from induction where User_Name='".$_SESSION["UserID"]."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{// if record exists do something

---- hide the add / edit / delete buttons --------------------------------



$xt->assign("add_link",false);
}

else return;

{
// if dont exist do something else
}
I have tried including all variations on from the html editor

$xt->assign("edit_link",false); etc... to rid me of the edit but without success.

many threads exists but none seem to work.. I need to remove the edit icon along with the button.
Thanks as always.

C
cgphp 3/4/2012

Move the code to the "List page: after record processed" event:

global $conn;

$strSQLExists = "select * from induction where User_Name='".$_SESSION["UserID"]."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{// if record exists do something

$record["edit_link"] = false;

}