TOPIC:

"Ticket ID" when submit form 4 years 2 months ago #169554

  • Topic Author
  • marcopolosrl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
Hi all,

I need to create a form of technical assistance. When the user submits the form, it must be generated an incremental id number (7 digits).
For example: 0000001, 0000002, 0000003 ...
This ID must obviously be registered on the database.

I was thinking of creating a hidden field and use the id of the table "_facileforms_records" to create my ticket id, but I encountered several problems.

How can I accomplish this?

I hope you can help me

Thanks!

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

Last edit: Post by marcopolosrl.

"Ticket ID" when submit form 4 years 2 months ago #169747

  • Tihomir's Avatar
  • Tihomir
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 3568
  • Karma: 87
  • Thanks: 288
Hello there,

you can try to do the following.

1) create an element ,textfield or hidden input , and put the name that you want.

2 ) go to the form > advanced > more options > form pieces > before form > custom , and put the following code into the box :
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object


//Create your own query 
$db->setQuery('Select lpad(max(id), 7, 0) From #_facileforms_records WHERE name ="nameofthetable" '); 

$result = $db->loadResult(); //load the result from the query

ff_setValue('elementname', $result); // populate the value in the form. Change ElementName to the real name of your element

Pay attantion to put the right name of the table instead of '#_facileforms_records' , also to put the right name of your element instead of 'elementname' into this part of the code:
ff_setValue('elementname', $result);

So, in the query above you will get the latest inserted id , as it always goes to the higher values.
Also, it is set to 7 digits, so your ticket nubmer will be created as '0000001'

Let us know if that worked for you , or if you have any questions regarding this example.

Kind regards
===============================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===============================================
Regards
Tihomir
==========================================
+++ Purchase Professional Support: crosstec.org/en/support/purchase-additional-support.html +++

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

Last edit: Post by Tihomir.

"Ticket ID" when submit form 4 years 2 months ago #169894

  • Topic Author
  • marcopolosrl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
Many thanks Tihomir for your answer, it works but there is a problem. In case where two (or more) users visit the page at the same time, they will see the same ID.
I believe that the ID must be entered on the DB after you submit the form, checking the latest current id.
Maybe just put it into form pieces > after form?

Thanks again

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

"Ticket ID" when submit form 4 years 2 months ago #169946

  • Tihomir's Avatar
  • Tihomir
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 3568
  • Karma: 87
  • Thanks: 288
Hi,

does your id must to be with 7 digits , or it can be present as current id from the database table?
Solution may be much easier if you would like to present it as current id.

Pls let me know before further testing.

Kind regards
===============================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===============================================
Regards
Tihomir
==========================================
+++ Purchase Professional Support: crosstec.org/en/support/purchase-additional-support.html +++

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

Last edit: Post by Tihomir.

"Ticket ID" when submit form 4 years 2 months ago #169948

  • Topic Author
  • marcopolosrl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
It must be with 7 digits

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

"Ticket ID" when submit form 4 years 2 months ago #170171

  • Topic Author
  • marcopolosrl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
No one can help me?

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

Moderators: ForumSupport
Time to create page: 0.054 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!