Existing registrant should not be able to proceed when clicking 'ENTER' and have the following error message (in red) display below the Email Address field: Oops! This email address has already entered the competition. can u guide me on this requiremnet
Taking a stab in the dark and assuming this is hosted on a cloud page, here is what I would do:
- Have the page post to itself
- Have a lookup inside AMPScript to see if the emailaddress already exists in your DE
- Have a conditional to display error text if already exists or to do an AMPScript insert if it does not and display success content.
To post to itself:
<form action="yourCloudPageURL" >
%%[ /* Assuming the input name is 'EmailAddress' This will pull the input value into AMPScript */ SET @EmailAddress = RequestParameter("EmailAddress") /* This will check to see if the email address exists in DE */ SET @Lookup = LOOKUPROWS('yourDE', 'EmailAddress", @EmailAddress) ]%%
%%[ IF ROWCOUNT(@Lookup) == 1 THEN InsertData('yourDE','EmailAddress',@EmailAddress) ]%% <p style="color:green">Thank you for entering our competition!</p> %%[ ELSE ]%% <p style="color:red">Oops! This email address has already entered the competition.</p> %%[ ENDIF ]%%
You can also use this conditional logic to show/hide the form after submission to help prevent accidental double submissions.