Forums

Two form submits - one button?

edog5948 22 Mar, 2012
I'm strugging with the following task:

I have one form. The data from the form needs to be:
- Validated
- Submitted to an external site (that requires a return URL; return URL is the 'Thank you' page)
- Sent to administrator email which contains all the form data

I've been trying to do this (unsuccessfully) outside of Chronoforms, so now I'm asking to see if it's possible inside Chronoforms to do this????
GreyHead 22 Mar, 2012
Hi edog5948 ,

Yes, it's almost certainly possible. You'd use either the cURL action or the Redirect URL + Redirect User actions to link to the external site depending on whether you need to transfer the user to the other site.

Bob
edog5948 23 Mar, 2012
Great news!

I'm a newbie to curl, so let's see if I have this straight:

Take a simple test form with one text element, LastName

On my form I could have
- event onSubmit
- action = http://externalsite.com/code.php
- curl =
TargetURL = http://internaljoomlasite.com/.../article&id=212
Params/Fields map = lname={LastName}

Then when I get to TargetURL (my Joomla article), how do I retrieve the data I set via curl?
Do I use JRequest::var? Or read $_POST?
This is where my inexperience shows.
GreyHead 23 Mar, 2012
Hi edog5948 ,

No! If you use an On Submit URL then the form is submitted there, ChronoForms never sees it and can't do anything at all with the form data.

What happens on the external site? Do you need to transfer the User and the data there or just the data?

Bob
edog5948 23 Mar, 2012
Just the data.
The external site is Zoho and I just need to populate a record there. But, it requires a return URL.
I'll set the return URL to my Joomla page that says Thank You.

I'm just confused on:
- where to send the email to the administrator
- how to retrieve the form data to populate the email
GreyHead 24 Mar, 2012
Hi edog5948,

If you are only sending the data why do you need a Return URL? That doesn't make sense???

To send the data alone use the cURL action. Drag a copy into the form On Submit event along with the Email action.

There are a series of videos here that will help you get started with CFv4.

Bob
edog5948 25 Mar, 2012
OK - I see.
The form generator on Zoho says a returnURL is required, but that doesn't necessarily mean I have to put it in the actual form code. 🙂

Now, when I submit the form via cuRL action on the OnSubmit event, how do I handle where the variable name has spaces? The variable required by Zoho (the remote server) is "Last Name".
<input type='text' maxlength='80' name='Last Name' /> 


In my ChronoForms form, I have the variable "lname". And I want to map this to "Last Name" for the remote server.

I've tried several Params/Fields mappings, but no luck so far:
[list]
  • Last Name={lname}

  • 'Last Name'={lname}

  • "Last Name"={lname}

  • Last+Name={lname}

  • Last%20Name={lname}

  • "Last Name={lname}"
  • [/list]
    GreyHead 26 Mar, 2012
    Hi edog5948 ,

    Looking briefly at the Zoho API docs it looks as though they use XML for the data transfer and so you'll need to build an XML string/file to of this. You can then use Curl to send the data.

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