Community > Answers
68 views

Check if value exists

I need to check if someone already submitted a form with a certain email address. If so, they must receive a message...

To check this I thought Form Action > On Form Validation > Execute SQL would be the way to go, and I used this:

SELECT COUNT(*) FROM LiveForms_SubmissionInfo WHERE FieldValue = '[email protected]' AND FieldGUID='F9C9CE7A-5494-453F-AFD5-450B2171D4AD';
And beneath that I used IF SQL RESULT Is Not Equal To 0

I also checked this in Management Studio first and it returned 0 befóre the first time I submitted and 1 áfter the first time I submitted, so the returnvalue should do it...

But... no message in my Live Form!

What am I doing wrong??

Keston Pollard Keston Pollard
asked 11/09/2021 13:31
Add Comment
Keston Pollard
replied 11/10/2021 10:17

SELECT COUNT (*) FROM LiveForms_SubmissionInfo WHERE (FieldGUID = 'F9C9CE7A-5494-453F-AFD5-450B2171D4AD') AND (FieldValue = '[E-mailadres]')

with 

IF SQL RESULT Is Not Equal To 0

also doesn't work...

Last Activity 11/19/2021 04:04

2 Answer(s)

  • answered 11/10/2021 11:01
    Ashish Pachori
    Add Comment
    Keston Pollard
    replied 11/10/2021 11:46

    Tnx Ashish,

    I need to have 0 or 1 returned from the SQL-action. It should check if an email address exists. If it does it should not return 0 and a message should appear; if it doesn't it should return 0, all is ok and no message should appear.

    SELECT COUNT(*) FROM LiveForms_SubmissionInfo WHERE FieldValue = '[E-mailadres]'

    does not work, where it should return 0

    I'll go ahead and try the second option...

    Ashish Pachori
    replied 11/10/2021 12:02

    Make sure you are seeing validation after submitting the form because The validation will be visible once you submit the form. 

    Keston Pollard
    replied 11/10/2021 12:26

    mmm. also not working. Just to be clear: I need to check the email address that the user fills in at that moment... so I'm working with the field [e-mailadres] and not with a set value...

    Ashish Pachori
    replied 11/10/2021 14:00

    Please open a support ticket regarding this through https://www.mandeeps.com/support/standard so that we can take a look.

    Keston Pollard
    replied 11/10/2021 14:07

    ok, I found out that the second option works only without the single quotes surrounding the email address in the SQL-query.

    So...

    SELECT COUNT(*) FROM LiveForms_SubmissionInfo WHERE FieldValue = [Emailadres] AND FieldGUID='F9C9CE7A-5494-453F-AFD5-450B2171D4AD';

    works! 

    Tnx


    Reply
  • answered 11/19/2021 04:04
    james234298 jerry
Add an Answer