🔥 500+ people already subscribed. Why not you? Get our newsletter with handy code snippets, tips, and marketing automation insights.

background shape
background shape

How to properly handle form submission

On many occasions when handling any form submission single cloud page application is used. This is great as all of error handling, form submission and processing is on one page so it is actually simpler to implement. But here are some thing you need to take into consideration.

Handle GET form submissions

I have seen lots of cloud pages made in a way that i could easily submit the form via the get request.

%%[
SET @submit =  RequestParameter("submit")
IF  NOT EMPTY(@submit) THEN
	//process the form
END IF
]%%

You can easily submit the form with the url parameters:

example.com?submit=22

This can be avoided by asking if the request is POST

<script runat="server">
    Platform.Load("core","1.1.1");
    Variable.SetValue('@request', Platform.Request.Method);
</script>
%%[
SET @submit =  RequestParameter("submit")
IF  NOT EMPTY(@submit) AND @request == "POAST" THEN
	//process the form
END IF
]%%

Accidental form resubmission

When form is processed you want to show user that the information has been successfully saved. You somehow refresh the page and resubmit the form again. This can be easily solved by redirecting user after form has been successfully saved to another success cloud page

SET @successPage = 333 //success page id
IF  NOT EMPTY(@submit) AND @request == "POAST" THEN
	//process the form
	Redirect(CloudPagesURL(@successPage, 'param','value')) 
END IF

Another possible enhancements that can be done to our cloud page form submission is to add reCAPTCHA to get rid of spam.

Oh hi there 👋
I have a SSJS skill for you.

Sign up now to get an SSJS skill that can be used with your AI companion

We don’t spam! Read our privacy policy for more info.

Share With Others

The Author
Marcel Szimonisz

Marcel Szimonisz

MarTech consultant

I specialize in solving problems, automating processes, and driving innovation through major marketing automation platforms—particularly Salesforce Marketing Cloud and Adobe Campaign.

Your email address will not be published. Required fields are marked *

Similar posts