Form Help

TOPIC:

Check email not duplicate in form - contest 1 year 10 months ago #232151

  • Topic Author
  • webp
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
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; }

Please Log in or Create an account to join the conversation.

Check email not duplicate in form - contest 1 year 10 months ago #232161

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
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
The following user(s) said Thank You: webp

Please Log in or Create an account to join the conversation.

Check email not duplicate in form - contest 1 year 10 months ago #232221

  • Topic Author
  • webp
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
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!

Please Log in or Create an account to join the conversation.

Check email not duplicate in form - contest 1 year 10 months ago #232233

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
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
The following user(s) said Thank You: Tirthankar

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.099 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!