1

I am making a cloud page to be a subscription centre. When the page is requested with a GET I want the user to submit a form on the page. When the page is requested with a POST, I want to unsubscribe the user.

According to this page when a cloud page is requested with a get request, @@ExecCtx == "LOAD". When the page is requested with post request, @@ExecCtx == "POST".

However I can't seem to make this happen.

I made a cloud page that posts to itself:

%%[
 VAR @key, @test
 SET @key = IsNullDefault(RequestParameter('key'), 'null')
 Set @action = CloudPagesURL(862, 'key', @key)
]%%
<form action="%%=Concat(@action)=%%" name="subscribeForm" method="POST">
    ...
    <br>Context: %%=Concat(@@ExecCtx)=%%
    <br>Request Parameter 'key' : %%=Concat(@key)=%%
    <br>Listname: %%_listname%%
    <br>GET:  %%[[type="Get"]  Output(Now()) ]%%
    <br>POST: %%[[type="Post"] Output(Now()) ]%%
</form>

However, even after submitting, and verifying that the request method is POST rather than GET, it seems to display only as a GET request?

enter image description here

  • Please explain clearly what do you want – pkharries Feb 19 at 10:08
  • Edited to try to clarify my objectives. – mercifulhop Feb 19 at 10:29
2

You can use the solution where you set a hidden parameter in your form, e.g.:

<input type="hidden" id="submitted" name="submitted" value="submitted">

Once submitted, you check for the parameter on the same Cloud Page:

%%[ IF RequestParameter("submitted") == "submitted" THEN ]%%
Show content and execute ampscript upon form submission 
%%[ ELSE ]%%
Show form fields
%%[ ENDIF ]%%
  • Thanks I'll try that out! – mercifulhop Feb 22 at 1:03
3

According to the Ampscript guide:

In the current release of Marketing Cloud, the @@ExecCtx variable will always return load, irrespective of the context. This is a known issue and should be resolved in a future release.

Source

  • Thanks Jeremy! Sadly that does explain a lot. But then how do I get code to run only on a POST context? POST: %%[[type="Post"] Output(Now()) ]%% didn't work... – mercifulhop Feb 20 at 0:28

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.