Forum

Thread tagged as: Forms

Posting to forms from another site

Hey guys

We have 5 Perch sites on different domains and want to capture forms in the primary site. Is it possible to post from domain-a.com to domain-b.com, capture the details in domain-b.com's perch install, then redirect back to domain-a.com?

Each site has its own Perch instance.

Russell Back

Russell Back 2 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, I think so. You'd need to make sure the form template is the same on sites.

Drew McLellan said:

Yes, I think so. You'd need to make sure the form template is the same on sites.

How would we do it though? A hidden return URL or something like that?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you could include the return URL in a hidden form field.

Sorry, Drew. I can't see that in the docs. What name should it be - 'returnUrl'?

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's nothing built in to do that - you'd need to implement it yourself.

Sorry, I think I'm missing the point. How would we do that - changing the code of the forms plugin directly?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You could, but it would be simplest to just write some PHP to do it.

It's not something the software does out of the box, as you'll appreciate it's a very bespoke requirement. If you don't have any development capability at your end, then the answer is probably no, Perch doesn't do that.

I think you could probably create the forms so that they are capable of running on the primary site, and then display each form as an iframe on each secondary site?

I've got the form posting to a separate site and redirecting back. How can I get a PHP value into a form field?

Here's my form template:

<perch:input type="hidden" id="redirect_url" value="" />

I need to output the URL of the current page in the value field so that gets passed along to the destination site as the URL to bounce back to.