Jump to content

Submitting PS Contacts Form with Javascript


beepow

Recommended Posts

Hi,
I need to submit contacts form using javascript on PrestaShop 1.6
Since there were some issues with Iubenda's consent solution I've asked them to get some help and seems that the only way to have the contacts correctly stored into Consent Solution Registry is to use the script they sent me (see below).

 

document.getElementById("submitMessage").onclick=function(e){ e.preventDefault(); _iub.cons_instructions.push(["submit",{ form: { selector: document.getElementById("form-contatti"), map: { subject: { first_name: "contact[name]", email: "from" }, } }, consent: { preferences: { privacy_acceptance: true, }, legal_notices: [ { identifier: 'privacy_policy', }, { identifier: 'cookie_policy', }],}}, {success:function(response){console.log(response)},}])  document.getElementById("form-contatti").submit(); }

 
This script actually saves the records for every submission, but it does not send email anymore.
Is like the

 {if isset($confirmation)} 

does not come true: the page reloads after clicking the submit button, but no confirmation message appears and no mail is sent.

 

The script (inserted in literal brackets) blocks the real sumbission (if I delete the

".submit"

part from the script it does not even reload the page while Iubenda saves the values instead) or maybe it happen without some value  or without a listenable event.

So I need to make 

{if isset($confirmation)}

true, I guess.
But I don't know how.

I hope I made myself understood!
Thanks

F

 

Edited by beepow (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...