This topic is locked

Details page based upon dropdown field in master table

1/31/2008 5:46:35 PM
PHPRunner General questions
E
ewold author

I am trying to make a dropdown on the master page that sets a field to a specific code. Choices are A , B , or D for example
For each of the choises the detail page has different table to show as detail.

For example if on the master page choice A is set, and you click details there will be 5 fields filled in. with choice B it will be 8 fields from another table, or different fields from the same table ( i don't know what's the easiest way).

For C other fields or table and so on ...
This is if a customers buy's for example a PC and you set the dropdown to PC, you get on the details the Brand, CPU , Memory and such things.

When another customer (or the same) buy's a Chair, you set the dropdown to furniture, you get on the details , Brand, size, price, type
Anyone some idea how to realise this ?

E
ewold author 2/1/2008

Spend some hours on this today but no success...

At the moment i created a extra column and tried several things, can someone help me to validate the value of another column in the same row, named Type, field is just a number in the database. But shown as a name because it is a lookup value in the add/edit page.
I've created several other tabels that have a master/detail relationship with all the same master table. because every record has just one type, its not useful to display 10 links at the left when i only use 1 for each record, it would be better to have just a link 'Details' that depens on the type field.

I've tried i with a code snippet, tried with the html editor but i can't get it working (i'm not a php programmer).
Roughly said i try to do a logical if function :



if $row.Type=1 href="_type1_Detail_list.php?{$row.1_Type1_Detail_masterkeys}" Details

elsif $row.Type=2 href="_type2_Detail_list.php?{$row.1_Type2_Detail_masterkeys}" Details


Left some html <a class> and </a> out of it , but when can i validate just the row i would be on the right way.

Can anyone help me out with this ?
I can PM or email you the website (altough its dutch)

E
ewold author 2/1/2008

I came to a solution with the following code , I used the type column to create a Hyperlink in the visual editor and used custom view

if($data["type"]==3)

{

$value="<a href=\"_Type3_list.php?_%5FPolis&masterkey1=".$data["PolisID"]."\">".$value."</a>";

}

if($data["type"]==1)

{

$value="<a href=\"_Type1_list.php?_%5FPolis&masterkey1=".$data["PolisID"]."\">".$value."</a>";

}



Hope this come in usefull for someone else to. Maybe not the cleanest way (because every type has its own if declaration) to work this out but it does the job.
Edit: Now i have one very weird thing, i had commented the 3 columns where the ajax onmouseover of the detail pages are.

The weird thing is , when i have this commented and reopen the site, if i select a detail from the link i made, i get all the details without the master table on top, however when i comment out the columns so they are visible again , if i click the link without passing over the links i have the same problem all details are displayed and no master table on top but when i go over the ajax detail page and then select the link, all works fine <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=25461&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=25461&image=2&table=forumreplies' class='bbc_emoticon' alt=':blink:' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=25461&image=3&table=forumreplies' class='bbc_emoticon' alt=':blink:' />

Is there a session variable i must load prior to clicking the link or am i missing something else here ?
Edit 2 : Stupid of me not to set the mastertable <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=25461&image=4&table=forumreplies' class='bbc_emoticon' alt=':)' />
Better code

if($data["Type"]==3)

{

$value="<a href=\"_Type3_list.php?mastertable=%5FPolis&masterkey1=".$data["PolisID"]."\">".$value."</a>";

}

if($data["Type"]==4)

{

$value="<a href=\"_Type4_list.php?mastertable=%5FPolis&masterkey1=".$data["PolisID"]."\">".$value."</a>";

}

if($data["Type"]==5)

{

$value="<a href=\"_Type5_list.php?mastertable=%5FPolis&masterkey1=".$data["PolisID"]."\">".$value."</a>";

}