# Calculate

Home Forums Quform WordPress Calculate

This topic is: resolved
Viewing 6 posts - 1 through 6 (of 6 total)
• Author
Posts
• #29694

I have three text fields, the first two, 5_3 and 5_4, is for adding the desired amount of money, and the third field(5_6) is for adding the sum of these two values, and if it is filled in with the wrong value, show an error message.

Exemple:

Fill – 1º Field = 200,00
Fill – 2º Field = 100,00

Fill – 3º Field = 300,00 Corretly
or
Fill – 3º Field = 250,00 Error message (validation)

how can I do this?

#29706

I managed to do the calculation, now i need to know how to do an identical validation, I added the value to the hidden field.
` // Set the value of the hidden field \$ ('. quform-field-5_5'). val ('\$' + total); `
I need to check the value of the hidden field in the text field

help me ally

#29719

#29721

Thank you,

In that case I would use the following code?

`add_filter ('quform_element_valid_5_6', function (\$ valid, \$ value, Quform_Element_Field \$ element) { \$ form = \$ element-> getForm (); \$ otherValue = \$ form-> getValue ('quform_5_5'); if (\$ value = \$ otherValue) { \$ valid = true; }   \$ valid = false; }, 10, 3);`

#29722