× Form Help

Check email not duplicate in form - contest

  • webp
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0

webp created the topic: Check email not duplicate in form - contest

Hello,
I have created a new form for a contest and I have to check that email is entered only once in that form.
Since I have 2 form in this website the email has to be unique only in form number 2.
I can check email value in #__facileforms_subrecords but I can't resolve the form number from #__facileforms_records

I have that code that works on the #__facileforms_subrecords without check the form number. Can someone help me?

$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library	
$email = ff_getSubmit('email');
$db = JFactory::getDbo();
$db-> setQuery("SELECT COUNT(*) FROM #__facileforms_subrecords WHERE value = '".$email."'");
$result = $db->loadResult(); 
if($result > 0)
   { header("Location: error.php"); exit; }
#232151
  • Posts: 1465
  • Karma: 48
  • Thank you received: 194

mihaela replied the topic: Check email not duplicate in form - contest

Hello,

Here is the query that would check only for email entries for certain form:
setQuery("SELECT COUNT(*) FROM #__facileforms_subrecords WHERE value = '".$email."' AND record IN (Select id FROM #__facileforms_records WHERE form='2') ");
NOTE: You have to replace 2 with the form's ID.

Despite that, since every element has his unique number, you could write simpler query to count number of entries of an email address in that specific form field (just in that second form) like this:
setQuery("SELECT COUNT(*) FROM #__facileforms_subrecords WHERE value = '".$email."' AND element = 23");
NOTE: You have to replace 23 with the number of that element which you can obtain either by Inspecting the element and grabbing it from "ff_elem23" or by looking at #__facileforms_subrecords table under element column.

This is the way I suggest you write the query since it is simpler.

Let me know whether you've managed to set this for your form.

Regards,

Mihaela
#232161
The following user(s) said Thank You: webp
  • webp
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0

webp replied the topic: Check email not duplicate in form - contest

Hello,

The first solution doesn't work.
When I save the Begin submit Piece I have a 403 error. Now I'm checking with hosting, probably is the link I use in the { header("Location:

But the second solution with element number works good!
It's very simple and I'm using it, before your explanation I didn't understand the use of the element number.
Thanks a lot!
#232221
  • Posts: 1465
  • Karma: 48
  • Thank you received: 194

mihaela replied the topic: Check email not duplicate in form - contest

Hello again,

I'm glad I've helped and that it works for you with the second solution.

If you have more questions, feel free to ask.

Regards,

Mihaela
#232233
The following user(s) said Thank You: Tirthankar
Moderators: ForumSupporttomeperica
Time to create page: 0.063 seconds

New Support System

Dear Customers,

Users with active subscription have support priority which will be dona via ServiceDesk (My Account > Raise a ticket).
FREE Support topics will be answered when AND if there is time.

You can check support guidelines here : here

Regards,
Crosstec Team

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99€

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here