This topic is locked

Custom Views and single Add/Edit/View button

10/9/2009 11:31:18 AM
PHPRunner General questions
A
aalekizoglou author

Hi,
I have to congratulate on a great product. I am building a new project and i have the following issue:
I have a single record and I have implemented some custom views in PHPR with different fields' selection based on a record type.

Now I have single list view, and have implemented a different ADD based on different buttons on the list view.

I also have implemented the different VIEW based on the recordtype with an event on the BeforeShowView. Here it is:
if ($values("strRecordType"]=="Initial Record")

{

header("Location: initial_view.php?editid1=".$values["iRecordID"]);

exit;

}

else

if ($values("strRecordType"]=="Second Record")

{

header("Location: second_view.php?editid1=".$values["iRecordID"]);

exit;

}
But I cannot implement the Edit View with an event on the BeforeShowEdit because I don't have access to the record data that are going to be edited, thus the $values.
Can anyone help me on this?
Athanasios Alekizoglou

J
Jane 10/12/2009

Hi,
field values are in the global $data array in the Edit page: Before display event:

global $data;

if ($data("strRecordType"]=="Initial Record")

{

header("Location: initial_view.php?editid1=".$data["iRecordID"]);

exit;

}

else

if ($data("strRecordType"]=="Second Record")

{

header("Location: second_view.php?editid1=".$data["iRecordID"]);

exit;

}