TOPIC:

Self incrementing integer field? 10 months 18 hours ago #237676

  • wilburg's Avatar Topic Author
  • wilburg
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 244
  • Thanks: 2
Is this possible? If so, how?
Colorado Woodworkers' Guild
Web Administrator

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

Self incrementing integer field? 10 months 10 hours ago #237685

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

Here is an idea for a solution that might work for you.

The other approach would be to get the value in that field from the last submission and increase it by one.
Here is how to make it work.
Please go to form's Advanced properties > More options > Form pieces and in Before Form section set Type to Custom and in the code area below put the following code:
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();//Get Database Object
$db->setQuery("SELECT value from #__facileforms_subrecords WHERE element = 7929 ORDER BY id DESC"); 
$tmp= $db->loadResult() + 1;
ff_setValue('FIELDNAME',$tmp);
NOTE: In the code above replace FIELDNAME with the Name of the field in your form. Also, replace 7929 with the element number of the field in your form where the integer should be displayed. You can get it by inspecting the element from the ID.

The other approach would be to write a query that would count the number of records for that specific form, but suggested above might be a better solution.

Let me know whether this solution is working for you.

Regards,

Mihaela

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

  • Page:
  • 1
Time to create page: 0.045 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

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!