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?

Calculation breaks whole form

More
4 years 5 months ago #6946 by AlexM
Calculation breaks whole form was created by AlexM
Hello,

I have created a form that included calculation fields. Later on, I needed to alter one formula and dong so, broke the whole form. The problem is that even if I change the equation back to something that I know that works, it will not work anymore.

There is a very easy way to break the calculation field with no way of fixing it:
([SAMPLE] >= 1) ?([SAMPLE]=200) : 0

Google Chrome gives me: "Uncaught SyntaxError: Invalid or unexpected token"
Microsoft Edge gives me: "SCRIPT1015: Unterminated string constant"

I understand if equation is wrong, it will not work, but how can I even try to do an equation when every time I type something wrong it fill crash and I will have to redo the whole form again?

Any ideas?

Thanks!

More
4 years 5 months ago #6948 by Administrator AV
Replied by Administrator AV on topic Calculation breaks whole form
Hi,

in Visforms calculations are a powerful and flexible feature.
Allowing the user to enter the calculation directly enables you to build really complex calculations and use a lot of different mathematical expressions and features.

The price for this is, that the usage requires at least some programming skills (knowledge).

There is a basic validation, when you try to save an equation, about the proper use of form field placeholders, but applying a syntax validation is not possible.

I'm sorry, But if the syntax of the equation is wrong, it is wrong.
What would be the benefit of catching the error.
The equation would still be wrong and using the form would result in invalid data...
You have to correct the equation but not to redo the whole form.
And if you modify the form significantly, you might also need to adapt the calculation.
([SAMPLE] >= 1) ?([SAMPLE]=200) : 0
Is simply wrong.
The part ([SAMPLE]=200) is incorrect. This must either be another comparison like (([SAMPLE]=200)?1 :2) or something like ([SAMPLE]*200). It must resolve to a value (a number).

Regards,
Aicha

: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 :-).

More
4 years 5 months ago #6949 by AlexM
Replied by AlexM on topic Calculation breaks whole form
Thank you for you reply

"You have to correct the equation but not to redo the whole form."

This is the whole issue that I am having, it will not work even if I fix the equation to something simple as ([SAMPLE]*200). The field will stay blank no matter what. The only way to fix it is to delete and create a new calculation field with the same equation ([SAMPLE]*200), then it will work again.

More
4 years 5 months ago #6950 by AlexM
Replied by AlexM on topic Calculation breaks whole form
Why is ([SAMPLE]>=1)?([SAMPLE]=200):0 is wrong?

I have a selection field with different values but I want them to be all equal in calculation. Thus, if the value is 1 or more, it will always equal to 200. I have removed the spaces, switched to dot decimal separator and it seems to be working fine.

Thanks!

More
4 years 5 months ago #6952 by Administrator AV
Replied by Administrator AV on topic Calculation breaks whole form
Hi,

Visforms runs on ten-thousands Joomla!-Instances.
All known bugs are fixed.

After changing the equation in a calculation field, and saving the changes, the result is visible in the front end immediately after you have refreshed the page with the form.

If that does not work on your website, this is the result of a bad individual configuration of your website.

Almost any error behavior is either due to wrong/bad site/page/server configuration/settings or caused by not really/complete Joomla-compatible templates/extensions/plugins.

Regards,
Aicha

: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 :-).

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum