So I have tested "Page_Redirecting" with a couple of scenarios, and discovered that the "Page_Redirecting event" is not working as I expected:
No "Page_Redirecting" event configured, but "Table > Page Return" setup as "View Page"
-> this is working like a charm, i.e. no problem!
No "Page_Redirecting" event configured, but "Table > Page Return" setup as "mypageadd.php?showmaster=user&fk_user_id=" . urlencode($this->user_id->CurrentValue) . "&fk_other_param_id=" . urlencode($this->other_param_id->CurrentValue)
-> this is also working like a charm, i.e. no problem and the confirmation page is displayed, next
-> the URL is: h t t p : / / localhost/test/mypageadd.php?showmaster=user&fk_user_id=123&fk_other_param_id=2 (i.e. THE ID VALUES ARE CORRECT)
-> and the record is inserted into the user table (i.e. the master table)
3 (a). "Table > Page Return" setup as "View Page", and "Page_Redirecting" event configured as: $url = "mypageadd.php?showmaster=user&fk_user_id=" . urlencode($this->user_id->CurrentValue) . "&fk_other_param_id=" . urlencode($this->other_param_id->CurrentValue);
3 (b). "Table > Page Return" empty (not setup), and "Page_Redirecting" event configured as: $url = "mypageadd.php?showmaster=user&fk_user_id=" . urlencode($this->user_id->CurrentValue) . "&fk_other_param_id=" . urlencode($this->other_param_id->CurrentValue);
-> PROBLEM, it now jumps directly to the detail page when trying to add to the master record (bypassing the master add page),
-> i.e. jumps directly to: mypageadd.php and no "ID" values in the URL,
-> it does not even go the the master page/table first to add a record in the master table, and the
-> the URL is: h t t p : / / localhost/test/mypageadd.php?showmaster=user&fk_user_id=&fk_other_param_id= (i.e. NO ID VALUES)
-> and therefore no record can be added to the user table (i.e. master table) as it is bypassed...
- As per 3 (a) and (b) above, but now with "Page_Redirecting" event configured as (based on what the user select in the master input record):
case ($this->myField->CurrentValue) {
switch:
case 1:
$url = "mypageONEadd.php?showmaster=user&fk_user_id=" . urlencode($this->user_id->CurrentValue) . "&fk_other_param_id=" . urlencode($this->other_param_id->CurrentValue);
break;
case 2:
$url = "mypageTWOadd.php?showmaster=user&fk_user_id=" . urlencode($this->user_id->CurrentValue) . "&fk_other_param_id=" . urlencode($this->other_param_id->CurrentValue);
break;
}
-> PROBLEM, in this scenario it does go to the add master record "add" page, but not showing the confirmation page (when submitting),
-> i.e. bypassing the confirmation page and jumps directly to: mypageadd.php (or in this case mypageONEadd.php for example)........,
-> therefore also not inserting the record into the user table (i.e. master table), and
-> the URL is: h t t p : / / localhost/test/mypageadd.php?showmaster=user&fk_user_id=&fk_other_param_id=2 (i.e. NO "FK_USER_ID" VALUE, othe_param value is good),
-> Due to incorrect values passed in the URL (and the fact that no master record is inserted), the detail record fails as well.
NOTE: the user select option with the switch works fine, but the URL parameters/values fail.