Forums

MultiPage to External SugarCRM

geocentricdesign 03 Apr, 2010
Hi. The form I am working on is a redesign of this currently working form: https://mikeshardmoney.net/apply.html except that I'm not using the accordion anymore but breaking the form into steps in ChronoForms. I set up a mother form called LoanApplication and 4 child forms so far called Contact, Property, Employment and Personal. Here is a breakdown of how each is set up:

LoanApplication - has MultiPage enabled under Plugins and has all the child forms entered into MultiPage with Enable Steps to Yes. No Form HTML code or other code. Where do I put the final submit URL (https://mikeshardmoney.net/leads/index.php?entryPoint=WebToLeadCapture)? I've tried using the Redirect URL field, Submit URL field, CURL plugin (which doesn't carry over child form elements under the General tab), and the Redirect plugin, none of which submits the data to SugarCRM. If I use the redirect plugin I get the posted session variables listed above the form in the next steps. If I use the submitURL in the mother then it submits after the first child form submit, even though the mother has the Finish submit button name for the final button added to it.

All the child forms have this code added to the Form HTML field:
<?php
$session  =& JFactory::getSession();
$posted = $session->get('chrono_formpages_data', array(), md5('chrono'));
?>

Data seems to save forward but not backwards (ie; fill out form 1, press next, fill out form 2, press previous, then next again, data in form 2 is not kept) with this button code:
<input value="Previous" name="previous" type="button" onClick="window.location='http://www.mikeshardmoney.net/joomla/index.php?option=com_chronocontact&chronoformname=LoanApplication&cfformstep=1'"/>
<input type="submit" value="Next" />


I'm not looking to use Joomla to save data but SugarCRM, which is on the same server/hosting account. So I haven't set up a data connection in ChronoForms. Do I need to in order to properly move between steps? It seems redundant to save in two databases. Also, how am I supposed to submit to an external database? All the code is copied directly from the first working form listed above. Any help is greatly appreciated!
GreyHead 03 Apr, 2010
Hi geocentricdesign,

I assume that you want to send the data to SugarCRM but don't need to send the user there. In that case the cURL is the correct method use. To access the full data it probably needs to be configured on the Mother Forms and there is should execute after the last Form step. The data in a multi-page for is carried forward in the session data and made available in a $posted array. You'll probably need to extract it from this array into the right fields for cURL. While you could use the plugin it might be just as easy to hand-code the cURL into the the OnSubmit After box of the mother form.

Bob

PS I've just noticed that you are on the same host. You could write directly from ChronoForms to the SugarCRM database (Joomla supports multiple database connections).

PPS The $_POST display from the ReDirect plugin is a bug (mea culpa) and there is a fixed version at several places in the forums here.
geocentricdesign 15 Apr, 2010
GreyHead, where can I find that fixed version for the ReDirect Plugin? I looked around but couldn't find it. Here's what I'm currently running:
ChronoForms_Plugin_V3.1_RC5.2
ChronoForms_V3.1_RC5.5

Also, I followed your post about how to create forms and found that I was confused in some areas. For instance, where exactly am I supposed to put the code that picks up the post array? I mean exactly what module and field needs it? And which method is the recommended way to do a multipage that submits to an external app on the same server? Or are there multiple ways that are equally viable?

Honestly I don't understand why it doesn't just work. It's not like there's anything complicated going on here. Confused and frustrated a bit :? Been playing with this for too long.

Thanks for your help!
GreyHead 16 Apr, 2010
Hi geocentricdesign,

Hmmm, I can't find it either. I may have got my plugins confused. Can you check if you have debug set to Yes in the plugin configuration?

You can set the cURL plugin (or most other plugins) either on the mother form or on any of the child steps depending on when in the workflow you need that action to take place.

Because the ReDirect plugin will redirect the user and end the work-flow it only really makes sense to use it as the last step on the Mother form. The problem there is to make sure that you have the right info available to use in the plugin. Off the top of my head I'm not sure exactly where it is by then. I think that it should all be in the $posted array (with the possible exception of file names). If so then it needs to be put into the $_POST array to be accessible to the plugin (it wasn't written with multi-page forms in mind). You can do this in the plugin Before code box with
<?php
JRequest::setVar('some_var', $posted['some_var']);
. . .
?>

Bob
This topic is locked and no more replies can be posted.