I had an issue that Laboratory Test order application where one Order may have different kind of Test type (I called Order Type). Based on Test Type or Order Type I planned to hide/show some fields on detail form. But it was failed and I don't find any solution to use javascript onload event for hide/show edit control on detail page based on conditional values on master page. Then I decided to use redirect technique to the detail page based on master form condition. In that case I need to popup different detail test forms after Master Form (Order) submit. I need to redirect the master order to specific detail form. I spent 2 weeks to solve with failure. I posted my problem in this forum with no reply. However, I solved it put it in this forum if any one needs in future for their similar kind of issue.
STEP 1: I created a single table (Test) in db with all required fields for all categories of tests.
STEP 2: I created several custom view tables (test_1, test_2 etc) from this single table as per different test categories.
STEP 3: I used all custom view tables as individual detail table to the Master table ORDER in phprunner setup window.
STEP 4: My Master table has one dropdown field call “Order Type” to select test category from the reference table “Order category”.
STEP 5: Now on master Add page put the following code as After Record Added event:
$_SESSION['ordtype']=$values['ordtype'];
if ($_SESSION['ordtype']=='1')
{
header("Location:test_list.php?mastertable=ord&masterkey1=".$keys["ordid"]);
}
else
{
header("Location:test_2_list.php?mastertable=ord&masterkey1=".$keys["ordid"]);
}
exit();
That’s it. It will redirect you specific detail page for specific Master record from the Master table after submit based on conditional dropdown select value on master form. If you find any better solution please let us know we may be benefited from your wise intellect by the Mercy of God.