0

Is it possible to have an AMPscript function only execute following the submission of a form?

For example, we have a Web Collect code that is unsubscribing a user from a list through Web Collect functionality. Ideally, we want to update a field in a Data Extension at the same time - but this will only be reflected once they've submitted their subscriber / unsubscribe status. How can I make sure that the Data Extension is only updated after they've submitted, as opposed to running once the page is loaded?

I've tried moving the function into a javascript function that is called after the submit, but it is still running once the form is loaded. I also cannot think of any AMPscript variable I can use to create an ELSE/IF statement that would help.

Any help is appreciated, thanks.

1

Yes, but not with Web Collect.

You'll have to build the form in AMPScript (or SSJS) using the API functions and have it post to itself or another page that does the work.

Since AMPScript and SSJS are server-side only, they only get processed a page-load.

| 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.