Hello akshehu,
There is no such thing as a sufficiently unique number with only 4 digits.
In this case, a simple unique counter is more appropriate.
The counter can then become too large at some point if there is too much form data.
You can generate your own unique code using SQL.
You can use all functions to calculate your counter and add additional text.
Solution:
- A field of type 'Text'.
- Protect the field against user input (A or

- A: Field Configuration >> 'Layout' tab >> 'Display Settings' group >> Read-Only = 'checked'.
- B: Field Configuration >> 'Layout' tab >> 'CSS Class Settings' group >> CSS Class For Control Group = 'd-none'.
- Field Configuration >> 'Basic Settings' tab >> 'Validation Settings' group >> Unique Values Only = 'Yes'.
- Field Configuration >> 'Basic Settings' tab >> 'Dynamic Settings' group >> SQL Field = 'Yes'.
- Field Configuration >> 'Basic Settings' tab >> 'Dynamic Settings' group >> Field value SQL statement = 'Your SQL statement'.
Unique counter, 3 options:
A: The next free record ID can be used as a unique counter:
B: There is a similar example in the forum, including various SQL statements.
Auto Increment Field:
vi-solutions.de/en/forum/19-joomla-exten...increment-field#9103
C: The SQL function 'UUID()' is suitable for a limited unique number, which you can also shorten to 4 digits.
Code:
select concat('TEST', substring(uuid(), 1, 4))
Note:
During the time the form is being filled out, another user may create a new form record.
In this case, the following setting prevents the saving of an identical value: Unique Values Only = 'Yes'.
If another user submits the same form in the meantime, an error message appears and the form must simply be submitted again without any changes.
The current value for the 'Text' field has already been automatically changed/incremented/adjusted.
Expanding Visforms:
We will expand the simple configurable options in Visforms.
I have created a development issue in the feature wish list:
Issue [VF-1494] Forum: Field Value or new Type: Unique number with start value and formattable counter
When we release the new feature, you will be explicitly informed about the release here in the topic.
Thank you again for your suggestion!
Kind regards, Ingmar