Redirect based on DB Read

megana 17 Oct, 2014
Hi there,

I have a DB Read action after my form is submitted and the debugger shows me it's getting these results:

Array
(
    [chronoform] => zipcode
    [event] => submit
    [zip] => 12345
    [button2] => Search
    [zipcode] => 
    [Data] => Array
        (
            [site] => landingpage
        )

)


In the "On found" section of my DB Read, I added a Redirect action. I want to have it redirect to mydomain.com/landingpage (or whatever the value for 'site' may be), but I can't figure out what to put in the "Extra params" box to make that work. Help please?

Much thanks!
GreyHead 18 Oct, 2014
HI megana,

Hmmm . . . there's a problem with this. The Redirect action is designed to build 'normal' URL with query strings like option=com_content&action=view&id=999 You are using SEF URLs which use a 'shorthand' version of the URL.

Instead of the ReDirect action please try a Custom Code action with this code in it
<?php
$app = JFactory::getApplication();
$app->redirect(JUri::root().$form->data['Data']['site']);
?>


Bob

PS If you turn off the Model ID in the DB Load action you can leave out the ['Data'] part.
megana 20 Oct, 2014
Thanks Bob! I was thinking it might need to be custom code but I hadn't a clue what code to use. That worked perfectly!
This topic is locked and no more replies can be posted.