Restrict Custom Form submission

(Nick Papadatos) #1

Matrix Version: 5.3

Hi Squiz folk,

Is there a way to restrict users from submitting a specific form multiple times?
i.e if users email address (as the unique identifier) already exists then return false?

I’m guessing you would query the form submissions and if the email address already exists return false?

If I use an asset listing page (not publicly available) to list all email addresses then use javascript to query emails in that array? Is there a server side check?

Actually not a good idea to expose email address at the front end so any thoughts on how this could work?

Don’t worry - problem solved


(Bart Banda) #2

How was it solved? …

(Nick Papadatos) #3

We ended up having to use javascript (ajax) on the form page contents to check if the email already exists when the form gets submitted. The ajax URL points to an asset listing page: format > %question_answer_XXX_q3^lowercase^replace_keywords:eq:{globals_get_email_check^lowercase}%,
Page contents: [%asset_listing%]

There’s also a trigger which has a set session var
Set session variable name > usersubmitted to value 1

    User has already submitted the form
     User has not submitted the form

Using the trigger alone would only track the browser session which is not ideal - Incognito you could submit the form again etc

So using a combination of trigger show/hide the form contents within the browser session and javascript works nicely