0

We have an iframe form setup on a landing page with both English and French language preferences. I want to get the URL parameter that shows Language type and write that value to a Data Extension upon form submission.

Can the above be done using SSJS? Is jQuery a better option than Ampscript to do it?

1

Just answering my own question :)

I solved it by passing an Ampscript variable, setting it up as a hidden field on form submit, and calling it during Post passing the subscriber's language to the data extension.

Something like this:

Sign-up page:

(Ampscript)

%%[
set @formlang = "en-CA" 
set @formlang = "fr-CA"
]%%

(HTML)

<input type="hidden" name="formlang" id="formlang" value="%%=v(@formlang)=%%"/>

Confirmation page - on POST

(Ampscript)

%%[
set @formlang = RequestParameter("formlang");   
UpsertData ('lang', @formlang)
]%%

if you have an alternative to the above, share it here - thanks!

| improve this answer | |
0

In your example, the language it's going to be always "fr-CA" as you are overwritting the @formlang variable (remember the code iscompiled top-down).

If you want the user to choose the language, insert a select option instead of the hidden. If you want to autoselect the preferenced language for the user, first retrieve the language value from the data extension: a) and update the option with the selected attribute. (to allow the user to modifiy the value) b) print the value in your hidden field %%v=()=%%

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.