TOPIC:

Self incrementing integer field? 3 years 6 months ago #237676

  • wilburg's Avatar Topic Author
  • wilburg
  • Offline
  • Premium Member
  • Premium Member
  • Registered
  • Posts: 259
  • 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? 3 years 6 months ago #237685

  • mihaela
  • Offline
  • User is blocked
  • User is blocked
  • Registered
  • Posts: 3128
  • Thanks: 416
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.044 seconds

Support Chat

Join our Discord chat and enter the Crosstec channels for live-support, chat forums and interact directly with the community!

After joining, please enter the Crosstec Area and use the #crosstec-support or #crosstec-general channels.

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

Subscribe to news and updates!

Special Offer

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!

Live Support Chat Opened!

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