I’m adding Experian’s Quick Address Postcode Lookup to a client’s website using a javascript/PHP popup on a Smarty templated website.
Does anyone know how to post the data from the popup back onto the Smarty form?
The process of the form is:
- Customer goes onto enquiry form (Smarty template)
- Customer clicks “Get My Address” button (activates js/php popup)
- Customer goes through the Address process and Accepts address (close popup)
- Data from the popup appears in the address boxes on the form
- The form is submitted with the usual {IF $SUCCESS} message
I’m stuck on number 4 so any guidance will be greatly appreciated!
You can do it pretty easily using the window.opener property in the JavaScript popup window.
Once you have the data you want in the popup, you could assign it back to the original form from the Smarty page like this:
There are a number of different ways you can access the form element, but that is the most basic and works without using jQuery, Prototype or any JS library functions.
Hope that helps.