-1

I want to add records into data extension through cloud page. I'm using upsertdata function and also enforcing server side validation in AMPScript

CloudPage:

<html>
<body>
<form action="https://test...." method="post" name="TestForm">
<input name="First_Name" id="First_Name" type="text" value="">
        <input name="Last_Name" id="Last_Name" type="text" value="">
        <input name="Email" id="Email" type="email" value="">
</form>
  </body>
</html>

%%[
set @FirstName = RequestParameter('First_Name')
set @LastName= RequestParameter('Last_Name')
set @EmailId= RequestParameter('Email')
IF NOT EMPTY(@FirstName) AND NOT EMPTY(@LastName) AND NOT EMPTY(@EmailId) THEN
UpsertData('DE',1,'Email',EmailId,'First_Name',@FirstName,'Last_Name',@LastName)
ELSE
RedirectTo('https://........')
ENDIF
]%%

If the above three fields values are blank i want to redirect to some error page which has been declared in else block. It was not redirecting to that page. Can you please help on this?

8
  • Are you getting an error? Are the rows getting upserted? Feb 11, 2018 at 13:05
  • Did you read the redirectto() documentation? It doesn't mean what you think it means. Feb 11, 2018 at 13:45
  • I have used redirect() function but when i publish the page, i m not gettting input form to enter first name , last name and email directly it was redirecting me to error page
    – user51860
    Feb 12, 2018 at 8:50
  • ELSE redirect(CloudPagesURL(69)) ENDIF]%%
    – user51860
    Feb 12, 2018 at 8:54
  • I have changed the code from ELSE block as below ELSE redirect(CloudPagesURL(69)) ENDIF]%%
    – user51860
    Feb 12, 2018 at 8:55

1 Answer 1

5

You should be using the redirect() function, not redirectto().

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .