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