This topic is locked

Disable detail table link

1/20/2009 5:43:26 PM
PHPRunner General questions
vin7102 author

Hi,
This might be a bit out there for phprunner but I have yet to hit a road block with this program.

Here's what I'm trying to do.

I have a master table called "work_week" and its linked to its child table "payroll_main".

In the master table, I have a field called "status" and its a static dropdown box with values "Locked" and "Un-Locked"

I'm looking to somehow disable the Master detail link whenever the status field has a value of "locked" so that particular detail record becomes inaccessible.

It would also be really great to reverse the effect if needed by changing the status back to "Un-locked" (but thats not as critical)
I would imagine it would have to be done with an "after record updated" event in the "Edit" page but don't know where to begin.
Any help is greatly appreciated

C
chaintm 1/20/2009

Hi,

This might be a bit out there for phprunner but I have yet to hit a road block with this program.

Here's what I'm trying to do.

I have a master table called "work_week" and its linked to its child table "payroll_main".

In the master table, I have a field called "status" and its a static dropdown box with values "Locked" and "Un-Locked"

I'm looking to somehow disable the Master detail link whenever the status field has a value of "locked" so that particular detail record becomes inaccessible.

It would also be really great to reverse the effect if needed by changing the status back to "Un-locked" (but thats not as critical)
I would imagine it would have to be done with an "after record updated" event in the "Edit" page but don't know where to begin.
Any help is greatly appreciated


http://www.asprunner.com/forums/index.php?...l=hide+the+view
that should help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36981&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

A
alang 1/21/2009

Another way as follows:

  1. Create an Alias field, say "Downlink" (only use on list view)
  2. In the visual editor, make it a custom field and add code:
    if($data["status"] == "Locked")

    $value = "<a href=payroll_main_list.php?mastertable=work_week&masterkey1={$data["<yr_keyfieldname in master table>"]}>Payroll</a>";;

    else

    $value = "";
  3. In the visual editor, delete the column manually that PHPR puts in for the detail table link
  4. If you want AJAX popup on this link you need to add more code in the visual editor

vin7102 author 1/22/2009

Hi AlanG
You were on the right track.. Thanks.

Before you submitted your post i had submitted a ticket about this and Jane responded with a support ticket solution:

"List page: After record processed" event

global $record;

if ($data["status"]=="locked")

$record["payroll_main_dtable_link"]=false;

else

$record["payroll_main_dtable_link"]=true;


It works perfect!

I do appreciate your help though!
Regards

Vince