Working With Redirects [V2.0]
- You can redirect between forms related to the same table
table1.layout1 -> table1.layout2 -> table1.layout3
- You can redirect between forms with tables unrelated to each other
table1.layout1 -> table2.layout1 -> table3.layout1
when configuring the redirect option - only type the field name
we already know that we are passing the current id (filter_groupid=[id] does not work)
For a combo box use "filter_whatever_fieldname" - without quotes in the reuse option of the redirect
For any integer field use "whatever_fieldname" - without quotes in the reuse option of the redirect
To pass between forms related to the same table use "id" - without quotes in the reuse option of the redirect
(great for making step by step wizards to complete large data entries in smaller steps)
Currently only the current id is passed - (the id of the record that is displayed)
The redirect works well now and you can pass integer values easily using the methods above
- it allows you to pass to a filter (combo box) using 'filter_some_id' = cid
- it also allows you to display a specific record by using id = cid
- it allows you to create step by step wizards based on the same table
- it allows you to pass the current id to any other layout
Limitations of current redirect method
- currently passing strings such as " Freds Group" it does work without code modification
- currently it does not allow you to pass the value of any other variable
the structure is there to pass multiple values as shown below
- the only thing is that the url becomes very long passing additional individual values
- an array of values could be passed as ....&values in the url
REDIRECT FUNCTIONS - V2.0 (30/9/12)
- The redirect functions can be found inside the controller file of the relevant layout
- The code below shows a save function snippet
case 'yyyyyy.save':
$this->applyRedirection($result, array(
'com_xxxx.yyyyyy.layout1',
'com_xxxx.yyyyyy.layout2'
), array(
'cid[]' => null,
'filter_some_id'=> 'cid['.$model->getId().']', // pass the current id
));
break;
For those wanting to pass more than one variable in the redirect to combos in the next form (not currently available in cook redirect) edit the relevant controller file save function
PASSING MORE THAN ONE VARIABLE - not currently available in cook redirect case 'yyyyyyy.save':
$this->applyRedirection($result, array(
'com_xxxx.yyyyyy.layout1',
'com_xxxx.yyyyyy.layout2'
), array(
'cid[]' => null,
'filter_some_id'=> 'cid['.$model->getId().']', // pass the current id
'filter_another_id'=> $item->another_id // add the the additional value for the combo here
));
break;
PASSING ALTERNATE VARIABLES - not currently available in cook redirect case 'yyyyyy.save':
$this->applyRedirection($result, array(
'com_xxxx.yyyyyy.layout1',
'com_xxxx.yyyyyy.layout2'
), array(
'cid[]' => null,
// remove this 'filter_some_id'=> 'cid['.$model->getId().']', // pass the current id
'filter_another_id'=> $item->another_id // add the the additional value for the combo here
));
break;