BF : calculate NB of form records in javascript

  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 203
  • Thank you received: 5

Gilles361 created the topic: BF : calculate NB of form records in javascript

Hi,
Correlate to previous question, I would like to calculate Number of records (Nb) in a javascript hidden element.
Is it possible?

Thks, Gil
#238128
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2738
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: BF : calculate NB of form records in javascript

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
#238134
  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 203
  • Thank you received: 5

Gilles361 replied the topic: BF : calculate NB of form records in javascript

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
#238137
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2738
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: BF : calculate NB of form records in javascript

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
#238141
Moderators: ForumSupporttomeperica
Time to create page: 0.061 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription 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 for just 49! (Summer Sale)

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the 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