This topic is locked

how to block edit for a specific record

2/4/2014 9:05:05 AM
PHPRunner General questions
ffrinai author

Hi,

i must block the edit record for a specific value of a field,

example:

fields: name:| phone: | editable:

Ted | 555-123456 | N

Ron | 555-67854 | Y

Bob | 555-987654 | N
in this example the permission of editing is only for record with name Ron

Thanks

Graphix 2/4/2014

Hi Fabiusf
you could just disable the save button if the value of editable = N

think you would have to disable the edit and inline edit button on your list page too (can be done easily in the 'Pages' menu option)
this code needs to go on edit page before display

if ($values["editable"] = "N")

{

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

}


i'm still a novice at PHP maybe someone with a bit more knowledge can refine or give you better code <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73919&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

regards

Kevan

ffrinai author 2/5/2014

I put this code on edit page before display,

if ($values["sex"] == "F")

{

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

}


and it works fine in edit page, but if i try the inline edit the: "edit", "inline edit" and "view" buttons disappears for the record with sex == "F".

How may i disable the "edit" and "inline edit" buttons in list page ?

thanks
Phprunner enterprise 6.2 build 16275



Hi Fabiusf
you could just disable the save button if the value of editable = N

think you would have to disable the edit and inline edit button on your list page too (can be done easily in the 'Pages' menu option)
this code needs to go on edit page before display

if ($values["editable"] = "N")

{

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

}


i'm still a novice at PHP maybe someone with a bit more knowledge can refine or give you better code <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73928&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

regards

Kevan

Graphix 2/5/2014



Hi Fabiusf
you could just disable the save button if the value of editable = N

think you would have to disable the edit and inline edit button on your list page too (can be done easily in the 'Pages' menu option)
this code needs to go on edit page before display

if ($values["editable"] = "N")

{

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

}


i'm still a novice at PHP maybe someone with a bit more knowledge can refine or give you better code <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73929&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

regards

Kevan


My bad I missed out an = sign.

if ($values["editable"] == "N")

{

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

}
Graphix 2/5/2014



I put this code on edit page before display,

if ($values["sex"] == "F")

{

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

}


and it works fine in edit page, but if i try the inline edit the: "edit", "inline edit" and "view" buttons disappears for the record with sex == "F".

How may i disable the "edit" and "inline edit" buttons in list page ?

thanks
Phprunner enterprise 6.2 build 16275


Have a look here http://xlinesoft.com/phprunner/docs/edit_page_settings.htm

Just untick edit and inline edit for your list page

HJB 2/5/2014

Would simply suggest to set "Ted" and "Bob" fields to READ-ONLY mode.

Graphix 2/5/2014



Would simply suggest to set "Ted" and "Bob" fields to READ-ONLY mode.


you could also do it via the security options <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73935&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

that's the way ive done it in one of my apps I created a users table and a groups table different groups have different access the groups I set were

Admin, Manager, Editor, Readonly, and a demo account.

This of course affects all records the question was about specific records.
Regards

Kevan