Calculate

Home Forums Quform WordPress Calculate

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  sistema 2 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29694

    sistema
    Participant

    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

    sistema
    Participant

    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

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #29721

    sistema
    Participant

    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

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #29725

    sistema
    Participant

    it works thank you

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy