TOPIC:

New form number 1 week 2 days ago #252555

  • Topic Author
  • Luisserafim
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 152
  • Thanks: 0
Hi!

Can we insert a fild with a new form number? That can be reset at the end of the year?

We have 2 or more forms online and the auto number is running. So far so good. What we want is a conting number for each form, in order to sequentially count each form.

The best solution is if we can add the date to the number like :

134/2021 for each form.

Tx in advance

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

New form number 1 week 2 days ago #252558

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2935
  • Karma: 3
  • Thanks: 255
Hi,

I made an example how to get this:
1) Add hidden element with name ele1->this represent year in 134/2021
Go to this element ele1 which represent year->Advanced->Init script -> check Form entry and put this:
function ff_ele1_init(element, condition){
element.value = new Date().getFullYear().toString().substr(-4);
} // ff_ele1_init
2)Add hidden element with name recID->this represent ID in 134/2021
Go to this element->Properties and in Value put:
<?php return $this->record_id; ?>

3)Add textfield in which this 134/2021 will be shown with name uniqueID

4) Go to form->Advanced->More options->Scripts->Initialization Script->check Custom:
function ff_uniqnum_init()
{
setInterval('ff_getElementByName("uniqueID").value = ff_getElementByName("recID").value + "/" + ff_getElementByName("ele1").value ',100);
} // ff_uniqnum_init
uniqnum is name of form
uniqueID is name of textfield in which this will be shown134/2021
recID is name of hidden element for record id
ele1 is name of hidden element for year

5) Go to form->Advanced->More options->Form pieces->Before form->check Custom:
$this->execPieceByName('ff_InitLib');

$db = JFactory::getDbo();
$db->setQuery("Select Max(id) From #__facileforms_records");
$next_record_id = intval($db->loadResult()) + 1;

ff_setValue('recID', $next_record_id);

Here is attachment with example:

File Attachment:

File Name: example31.zip
File Size:7 KB


Regards,
Tihana
Attachments:
The following user(s) said Thank You: Luisserafim

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

New form number 3 days 1 hour ago #252810

  • Topic Author
  • Luisserafim
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 152
  • Thanks: 0
Hi Tihana!

I understood the process but it was not quite this, it will be for another case and thanks for that :)

What is required is a unique number for each form.

ex:
form 1: starts on 1/2021
form 2: starts on 1/2021

both forms must be restarted at the beginning of the year so that the following year shows 1/2022

Thanks in advance

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

New form number 2 days 11 hours ago #252826

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2935
  • Karma: 3
  • Thanks: 255
Hi,

I create another example (I hope that this is ok for you).

File Attachment:

File Name: exampleLuis1.zip
File Size:7 KB


Let me know the result

Regards,
Tihana
Attachments:
The following user(s) said Thank You: Luisserafim

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

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

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

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!