This topic is locked
[SOLVED]

 disable or hide the standard save button

1/28/2014 9:39:49 PM
PHPRunner General questions
romaldus author

in edit page, how to disable or hide the standard "save" button based on a value in database field (not a field value in form)?
for example : if field value = 1, hide the save button. if field value = 0, show the save button
I tried to use the following code in edit page before display event but not work


if ($data["VOTE"] = '1')

{

$xt->assign ("save_button", false);

}


Graphix 1/29/2014



in edit page, how to disable or hide the standard "save" button based on a value in database field (not a field value in form)?
for example : if field value = 1, hide the save button. if field value = 0, show the save button
I tried to use the following code in edit page before display event but not work


if ($data["VOTE"] = '1')

{

$xt->assign ("save_button", false);

}



Hi Romaldus

I think you should be addressing '$values' not '$data'
try this code:
if ($values["VOTE"] !== '0')

{

$xt->assign ("save_button", false);

}
I have used '!==' because '!==' should match the value and data type '!=' just matches the value ignoring the data type
regards

Kevan

Graphix 1/29/2014



Hi Romaldus

I think you should be addressing '$values' not '$data'
try this code:
if ($values["VOTE"] !== '0')

{

$xt->assign ("save_button", false);

}
I have used '!==' because '!==' should match the value and data type '!=' just matches the value ignoring the data type
regards

Kevan


I have just read your post again if you don't want the user to see this field just set it to hidden.

romaldus author 1/29/2014

many thanks kevan. it works now with your code. Problem solved.

Graphix 1/30/2014



many thanks kevan. it works now with your code. Problem solved.


You are welcome <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73854&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

glad you are sorted