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.

Mass calculation of all calculation forms

More
4 months 3 weeks ago #9922 by L_Cypherus
Mass calculation of all calculation forms was created by L_Cypherus
Hello

I have a reservationform with lots and lots of different calculation cells.
Example (in dutch but you'll get what I mean by looking ;-)) www.degedektetafel.be/wv2/index.php/reserveringsformulier

I want a mass calculation to show them the total price of every cell combined.

Is this possible on an easy way or do I have to start a calculationform setings [CELL1]+[CELL2]+[CELL3]....

More
4 months 3 weeks ago #9923 by MaliRaj
Replied by MaliRaj on topic Mass calculation of all calculation forms
you start a calculationform setings ...

Freundliche Grüße aus PM
Heinz
The following user(s) said Thank You: Administrator IV

More
4 months 3 weeks ago - 4 months 3 weeks ago #9926 by Administrator IV
Replied by Administrator IV on topic Mass calculation of all calculation forms
Hello L_Cypherus,

There is another option with a little bit of JavaScript and the Visforms 'Frontend Webassets'.

Frontend Webassets:
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

With the following small JavaScript you can sum up any number of fields in one go and output the sum in a result field:
Code:
// calculate sum of field group labeled by common CSS-class 'css-number-add' jQuery(document).ready(function() {     console.log('FEWA script loaded');     jQuery('.css-number-add').bind('change keyup mouseup mousewheel', function() {         // re-calculate on value change         calculateSum();     });     jQuery('.visform').bind('visformsInitialised', function() {         // re-calculate on form is initialized         calculateSum();     }); }); function calculateSum() {     let sum = 0;     jQuery('.css-number-add').each(function() {         let val = jQuery(this).val();         // skip all of: is not a number         if(isNaN(val)) return true;         // keep multiplication with 1, otherwise it would be a simple string concatenation         sum += 1 * val;     });     jQuery('.css-number-add-result').val(sum); }

The form:
vi-solutions.de/forum-uploads/fewa-examp...-fields-sum_form.png

The procedure:
1 - Set the field's own CSS class 'css-number-add' for all input fields for the total sum
The field configuration of the result field:
vi-solutions.de/forum-uploads/fewa-examp...sum_input-fields.png

2 - Set the field's own CSS class 'css-number-add-result' for the result field
The field configuration of an input field:
vi-solutions.de/forum-uploads/fewa-examp...sum_result-field.png

3 - Paste the above script in the form configuration, tab 'Frontend Webassets', there in the 'Form' tab into the 'JavaScript' text field
The form configuration, tab 'Frontend Webassets':
vi-solutions.de/forum-uploads/fewa-examp...-fields-sum_fewa.png

I have set the result field 'number-add-result' to 'read-only' in the field configuration.

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: 4 months 3 weeks ago by Administrator IV.

More
4 months 2 weeks ago #9951 by L_Cypherus
Replied by L_Cypherus on topic Mass calculation of all calculation forms
Thanks

For step 2 (Set the field's own CSS class 'css-number-add-result' for the result field.)

What field type does I have to take?

More
4 months 1 week ago #9952 by L_Cypherus
Replied by L_Cypherus on topic Mass calculation of all calculation forms
Thanks

For step 2 (Set the field's own CSS class 'css-number-add-result' for the result field.)

What field type does I have to take?

More
3 months 4 weeks ago - 3 months 4 weeks ago #9955 by Administrator IV
Replied by Administrator IV on topic Mass calculation of all calculation forms
Hello L_Cypherus,

there was no need to repeat the question.
We had 2 weeks of vacation until yesterday and there was a red notice at the top of all the forum pages:
vi-solutions.de/forum-uploads/forum_out-...ssage_2024-01-07.png

The form in the example has the type 'number' as the result field with the name 'number-add-result'.
The code also works for a result field of type 'Text'.

The same applies to the input fields.

So you can use the types 'Text' or Number' for the input fields and the result field.

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: 3 months 4 weeks ago by Administrator IV.

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum