expo101
Posts: 24
|
| Posted: 05/21/2011, 3:40 AM |
|
In my CCS project I have a searchpage where the returnpage is specified under the Button_DoSearch properties. Based on one of the search values (a date value), I want the return page to be dynamic. When a date is specified the return page is 'return_1.ccp' and when no date is specified the returnpage should be 'return_2.ccp'.
I'm not an PHP expert, that's why I use CCS, but I'm sure this can be done with some PHP coding. Someone who can help me with this?
Frans de Jong
|
 |
 |
datadoit
|
| Posted: 05/21/2011, 6:50 AM |
|
Select the Search button, then in the Properties toolbox, choose the
Events tab. For the Server -> On Click, add Declare Variable.
Name: Redirect
Type:
Initial Value: (!$Container->TheDate->GetValue() ) ? "return_2.php" : ""
We're dynamically setting the value for the CodeCharge Redirect variable
using a PHP ternary operator.
(if this) ? then set the value to this : otherwise set it to that
|
|
|
 |
expo101
Posts: 24
|
| Posted: 05/21/2011, 1:56 PM |
|
Thanks Datadoit for your clear explanation. I now arrive at the desired page but the search values/parameters do not come with it so the pages do not show the correct search result. Do I have to put the search values in this string as well?
Thanks for your help.
Frans de Jong
|
 |
 |
datadoit
|
| Posted: 05/21/2011, 2:28 PM |
|
Then you'll need to build the redirect string to include the search
parameters.
(!$Container->TheDate->GetValue() ) ? "return_2.php?s_Field1=" .
CCGetFromPost("s_Field1", "") . "&s_Field2=" . CCGetFromPost("s_Field2")
: ""
|
|
|
 |
expo101
Posts: 24
|
| Posted: 05/22/2011, 5:49 AM |
|
Hello Datadoit,
Got it to work!! Thanks very much for your help.
Frans de Jong
|
 |
 |
|