Home › Forums › Quform WordPress › Calculate
- This topic has 5 replies, 2 voices, and was last updated 4 years, 9 months ago by sistema.
- AuthorPosts
- July 30, 2019 at 2:05 am #29694sistemaParticipant
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,00Fill – 3º Field = 300,00 Corretly
or
Fill – 3º Field = 250,00 Error message (validation)how can I do this?
July 31, 2019 at 12:01 am #29706sistemaParticipantI 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 fieldhelp me ally
July 31, 2019 at 11:20 am #29719AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
July 31, 2019 at 11:38 am #29721sistemaParticipantThank 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);July 31, 2019 at 11:42 am #29722AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
July 31, 2019 at 12:05 pm #29725sistemaParticipantit works thank you
- AuthorPosts
- You must be logged in to reply to this topic.