Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

Check value in calculation field

  • geert@huizechaos.be
  • Topic Author
  • Offline
More
9 months 1 day ago #10105 by geert@huizechaos.be
Check value in calculation field was created by geert@huizechaos.be
Hello,
I'm designing a form to track samples of bees from different hives. The idea is that the beekeeper takes a sample of 10 bees and puts them in a canister that has a sample number. The beekeeper has to enter this number in the form relative to the hive from which the sample is taken.
To avoid errors I want to include a check: the 4 first digits of the number are the sample number, the 2 next digits represent the remainder of the sample number divided by 97. ex. 70 being the remainder of 1234/97, 123470 is a valid number 123407 is not. (the same system is used in bank account numbers, at least in Belgium).
In a calculation field I can extract the entered check number and the calculated check number but I have no way to compare them....
Should I look into regular expressions? I hope not...
Kind regards,
Geert

More
9 months 1 day ago - 9 months 1 day ago #10106 by Administrator IV
Replied by Administrator IV on topic Check value in calculation field
Hello Geert,

Calculation fields can do a lot and are sufficient in many places.
Due to the highest possible security, the calculation becomes independent of each other
- a first time locally in the browser in JavaScript and
- done a second time in PHP in the backend.

However, this results in an intersection of the available functions and actions that you can use.
Because the code must be executable for JavaScript and PHP at the same time.

In your case, it is better if you implement your individual solution with JavaScript and the 'Visforms web assets'.
Here you have virtually all the options you need.
You can react (a field value changes), calculate and act as you wish (influence other fields).

You simply add your JavaScript code to the affected Visforms view (form, data, ...) using the Visforms 'Frontend Webassets'.
The procedure is described in the documentation.

Frontend web assets:
docs.joomla-5.visforms.vi-solutions.de/e...-frontend-webassets/
All settings are made in the form:
docs.joomla-5.visforms.vi-solutions.de/e...are-made-in-the-form
Examples of solving requirements with the frontend web assets:
docs.joomla-5.visforms.vi-solutions.de/e...-webassets/examples/

Kind regards, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 9 months 1 day ago by Administrator IV.
The following user(s) said Thank You: geert@huizechaos.be

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum