Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Power operator "^" does not work, but rather acts as addition. For instance 3^3 should equal 27 (3 raised to the 3rd power) but instead results in 6 (3+3).
Comment | File | Size | Author |
---|---|---|---|
#12 | support_for_power-2502619-12.patch | 2.34 KB | Snehal Brahmbhatt |
Comments
Comment #1
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedTry the patch webform_calculator-fixes_for_power_operator-2502619-1-D7.patch to resolve the issue you are facing.
Apply patch in
webform_calculator/webform_calculator.js
file.Let me know incase of any concern/query regarding this.
Thanks,
Snehal Brahmbhatt | AddWeb Solution
https://www.drupal.org/user/3147795/track
Comment #2
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedFollow this patch
Comment #3
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedComment #4
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedTry the patch power_operator_does-2502619-4.patch to resolve the issue you are facing.
Apply patch in webform_calculator/webform_calculator.js file.
Let me know incase of any concern/query regarding this.
Thanks,
Snehal Brahmbhatt | AddWeb Solution
https://www.drupal.org/user/3147795/track
Comment #5
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedComment #6
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedPlease test the patches provided in #2 & #4 for Version 7.x-2.x-dev
Comment #7
saurabh.dhariwal CreditAttribution: saurabh.dhariwal at AddWeb Solution Pvt. Ltd. commentedComment #8
rafenden CreditAttribution: rafenden at Digital Crafts Agency Ltd. commentedThanks for patch snehal.brahmbhatt.
I've tested it didn't work for me when using with formula
{a} ^ 2
.Additionally we should provide a patch for PHP code.
Comment #9
rafenden CreditAttribution: rafenden at Digital Crafts Agency Ltd. commentedSince power operator was removed changing category to feature request.
Comment #10
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedHi Rafal,
PFA patch for PHP code per your request. Check once and let me know your thoughts.
Comment #11
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedComment #12
Snehal Brahmbhatt CreditAttribution: Snehal Brahmbhatt at AddWeb Solution Pvt. Ltd. commentedIgnore #10 and check the latest updated Patch: "support_for_power-2502619-12.patch". This contains combined code for Javascript and PHP.
Comment #13
MichaelWimpey CreditAttribution: MichaelWimpey commentedHi Snehal Brahmbhatt, Thanks for the work on this so far, this is definitely a useful feature, which seems to be working, but on form submission, is giving the following error:
Error message
Warning: Division by zero in eval() (line 1 of .../sites/all/modules/webform_calculator/webform_calculator.module(55) : eval()'d code).
Comment #14
colemanw CreditAttribution: colemanw commentedReading the patch in #12 it looks like this will limit expressions to either use a power or other operators. So currently
{a} + {b} / {c}
works, but{a} + {b}^{c}
will not.Comment #15
lcfi CreditAttribution: lcfi commentedComputed values with arent saved in the database. We are looking for a paid solution to that problem.
Lawrence
Comment #17
colemanw CreditAttribution: colemanw commentedFixed by incorporating 3rd-party math libraries. This module now supports a slew of math operators and functions, not just ^.