TOPIC:

BF : calculate NB of form records in javascript 9 months 2 days ago #238128

  • Topic Author
  • Gilles361
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 224
  • Thanks: 5
Hi,
Correlate to previous question, I would like to calculate Number of records (Nb) in a javascript hidden element.
Is it possible?

Thks, Gil

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

BF : calculate NB of form records in javascript 9 months 2 days ago #238134

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

This crosstec.org/en/blog/939-count-number-of-records.html is an article explaining how to count the number of records for a specific form.

Here it is explained how to count them when submit button is pressed so that errors are avoided if two persons are filling in the form at the same time.

You can grab number of records on form entry simpler like this:

By putting:
<?php $db = JFactory::getDBO(); $db->setQuery('Select Count(*) From #__facileforms_records Where name="MyFormName"'); return $db->loadResult()+1; ?>
as value of an element, the number of records will be couunted when the form is entered.

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

Regards,

Mihaela

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

BF : calculate NB of form records in javascript 9 months 2 days ago #238137

  • Topic Author
  • Gilles361
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 224
  • Thanks: 5
Hi Mihaela,

1/ I've tested PHP (OK except error counts), but I'd need to create another Hidden ELEMENT for "NB record". This solution is OK, but I'd like to test limit in a single element, if possible...

COUNT ERRORS: I've noticed that counts are false if ("multiple Form user submissions") two counts in same minute. I've to wait almost 2 MINUTES (some "long" time) to get a correct record value!
Is there issue with DB / Joomla cache, or BF record fetch?

Otherwise, record value would be same, false by 1 or 2, depend of concurrent submissions in 2 minutes time. After 2 min, counts = OK.

2/ Scripting solution is far too complex for my users (to maintain)
Sorry !

Thanks, Gil

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

BF : calculate NB of form records in javascript 9 months 2 days ago #238141

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello again,

I assume that in 1) you are talking about this solution:
<?php $db = JFactory::getDBO(); $db->setQuery('Select Count(*) From #__facileforms_records Where name="MyFormName"'); return $db->loadResult()+1; ?>
I do not wkonw why it takes two minutes for you, but in my opinion this is not a BreezingForms issue, but something related to server or database.

The thing is that if one user enters the form and other enters it before the first one has submitted they will have the same count which will lead to an error.

That can be avoided using the jquery solution, but, in that case, the user will not be able to jump to a page based on result, unless he is redirected to a different web page based on result.

I hope that this will help you.

Regards,

Mihaela

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

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

Summer Sale!

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!