Hello Geert,
There was a very similar question about the field type 'Calculation' a week ago.
Is it possible to validate the calculation? Validate calculation?
vi-solutions.de/de/forum/19-joomla-exten...te-calculation#11190
The result is the development of a new feature:
vi-solutions.de/de/forum/19-joomla-exten...te-calculation#11201
I had created an issue for development in the wish list:
Issue [VF-1375] Forum: Calculation field: Add Validation for calculation result
When we release the new feature, you will also be explicitly informed about the release here in your topic.
Solution until then Option 1:
Until then, it is necessary to write some of your own JavaScript:
- Every time the calculated value changes
- you check your condition
- and as long as it is not met
- you deactivate the submit button and
- write a message in a suitable place.
You can achieve the behavior with some custom CSS/JavaScript and the Visforms 'Frontend Webassets'.
Frontend Web Assets:
docs.joomla-4.visforms.vi-solutions.de/e...-frontend-webassets/
All settings are made in the form:
docs.joomla-4.visforms.vi-solutions.de/e...are-made-in-the-form
Solution until then Option 2:
One option for developers is to create a custom plugin:
- After submitting the form
- you check in the backend on the server
- whether your condition
- and as long as it is not met you send the form back with a message.
The documentation describes how to create a 'Visforms Custom Plugin'.
Custom plugin creation:
docs.joomla-4.visforms.vi-solutions.de/e...-plugin-development/
Custom plugin event system:
docs.joomla-4.visforms.vi-solutions.de/e...-plugin-development/
There is a complete custom plugin with all events and help functions as a template that comes with the installation of Visforms:
docs.joomla-4.visforms.vi-solutions.de/e...-plugin-development/
The developer can then decide for himself what else should happen.
Creating a custom plugin requires some PHP development experience on Joomla.
Notes:
Option 1 occurs early.
Option 1 could be circumvented by a hacker by making changes within the displayed page, as it is a purely client-side solution in the web browser.
Option 2 comes later.
Option 2 is secure against changes by hackers.
A combination of option 1 and option 2 would be ideal.
Best regards, Ingmar