Hello Chronoforms team,
Firstly thank you for producing such a fantastic harness for forms, it has proven to be a fantastic tool over the last year for our organisation (a not for profit association). So much so I am moving a motion at the organisations AGM this year to purchase a 5 site registration for Chronoforms.
Recently we have had an issue with Joomla 1.5 and are now looking to migrate our websites to Joomla 2.5, as it is the latest version.
After installing Joomla 2.5 and Chronoforms V4 on our site I have been trying to move our old V3 forms over to the new V4 System, and I believe I have done about 95% of the work; however I am hitting an issue with the redirector that we used to use now does not work on the V4 system.
Our site contains registration forms for membership to our association and to attend association events. The registration forms have a drop down box in regards to a Payment Method.
In V3 on 1.5 I used to use the following code Onsubmit before emails in tandem with the Redirect URL plugin, to change the Redirect based on option selected. In the Redirect plugin the URL for PayPal was stored (actual URL's removed to protect the innocent🙂)
Now with the new Chronoforms, I have placed this code block into the onsubmit before emails section, and that runs after the redirect URL section, as that is how the V3 form was ordered (Plugins, Onsubmit, Autogeneration) of course Redirect User is last in Onsubmit block.
I have seen a few messages about Dynamic Redirect and this has helped me with the redirect, but this has meant that regardless of the selection all submissions are directed to the URL in the redirect URL page. Leaving it blank has not helped as this then redirects the user back to the main page (even after updating the URL in the final else function).
I have seen other code that mentions redirection that appears different to the code, as well as putting the code into a Customer code box so, I have three questions.
1) will this code work with Chronforms V4?
2) whatever code I use does it need to be put in a separate Custom Code box(not the before emails box)
3) What order after the onsubmit should this be done in, I would assume Captcha first, then Redirect URL then Custom Code (either before email or not) then lastly Redirect User (without a url).
I have look through some forum posts via Google and I can't find a clear answer on these questions, as I feel these are the places I am getting stuck.
Thanks for any suggestions.
Mark
Firstly thank you for producing such a fantastic harness for forms, it has proven to be a fantastic tool over the last year for our organisation (a not for profit association). So much so I am moving a motion at the organisations AGM this year to purchase a 5 site registration for Chronoforms.
Recently we have had an issue with Joomla 1.5 and are now looking to migrate our websites to Joomla 2.5, as it is the latest version.
After installing Joomla 2.5 and Chronoforms V4 on our site I have been trying to move our old V3 forms over to the new V4 System, and I believe I have done about 95% of the work; however I am hitting an issue with the redirector that we used to use now does not work on the V4 system.
Our site contains registration forms for membership to our association and to attend association events. The registration forms have a drop down box in regards to a Payment Method.
In V3 on 1.5 I used to use the following code Onsubmit before emails in tandem with the Redirect URL plugin, to change the Redirect based on option selected. In the Redirect plugin the URL for PayPal was stored (actual URL's removed to protect the innocent🙂)
<?php
$paymenttype = JRequest::getString('PaymentType', 'PayPal Payment', 'post');
if ($paymenttype == 'Money order')
{$url = 'http://www.mywebsite.org/content/index.php?option=com_content&view=article&id=14';
$MyForm->formrow->redirecturl = $url;
}
elseif ($paymenttype == 'Cheque') {
$url = 'http://www.mywebsite.org/content/index.php?option=com_content&view=article&id=14';
$MyForm->formrow->redirecturl = $url;
}
elseif ($paymenttype == 'Direct deposit') {
$url = 'http://www.mywebsite.org/content/index.php?option=com_content&view=article&id=14';
$MyForm->formrow->redirecturl = $url;
}
elseif ($paymenttype == 'PayPal Installment') {
$url = 'http://www.mywebsite.org/content/index.php?option=com_content&view=article&id=2&Itemid=7';
$MyForm->formrow->redirecturl = $url;
}
else {
}
?>
Now with the new Chronoforms, I have placed this code block into the onsubmit before emails section, and that runs after the redirect URL section, as that is how the V3 form was ordered (Plugins, Onsubmit, Autogeneration) of course Redirect User is last in Onsubmit block.
I have seen a few messages about Dynamic Redirect and this has helped me with the redirect, but this has meant that regardless of the selection all submissions are directed to the URL in the redirect URL page. Leaving it blank has not helped as this then redirects the user back to the main page (even after updating the URL in the final else function).
I have seen other code that mentions redirection that appears different to the code, as well as putting the code into a Customer code box so, I have three questions.
1) will this code work with Chronforms V4?
2) whatever code I use does it need to be put in a separate Custom Code box(not the before emails box)
3) What order after the onsubmit should this be done in, I would assume Captcha first, then Redirect URL then Custom Code (either before email or not) then lastly Redirect User (without a url).
I have look through some forum posts via Google and I can't find a clear answer on these questions, as I feel these are the places I am getting stuck.
Thanks for any suggestions.
Mark
Hi Mits,
The code structure in CFv4 has changed quite a lot. Specifically $MyForm is no longer used.
To do a ReDirection you an either use the Joomla! code to do an immediate redirection:
Alternatively I have an Event Switcher [GH] action that lets you switch between different events, or event streams, depending on a script. This may be more than you need here.
Bob
PS The JRequest method will still work OK but ChronoForms only uses this data to copy it into the $form->data array at the beginning of the event. If you need to edit data you should save it back into the $form->data array.
The code structure in CFv4 has changed quite a lot. Specifically $MyForm is no longer used.
To do a ReDirection you an either use the Joomla! code to do an immediate redirection:
<?php
$mainframe->redirect('url', 'optional message');
?>Or the equivalent of your code would be to use:<?php
if ( xxx ) {
$form->data['redirect_url'] = 'some_url';
}
?>and then drag a ReDirect User action into the On Submit event to do the Redirection.Alternatively I have an Event Switcher [GH] action that lets you switch between different events, or event streams, depending on a script. This may be more than you need here.
Bob
PS The JRequest method will still work OK but ChronoForms only uses this data to copy it into the $form->data array at the beginning of the event. If you need to edit data you should save it back into the $form->data array.
This topic is locked and no more replies can be posted.
