• Resolved malpica

    (@malpica)


    Hi,
    I have a problem with one formula:
    I have two buttons and one number field. I need that when I click in one button the number field is automatically populated with value of another calculated field, and the same with when I click the other button, but if the user want can populate number field manually.
    I have inserted this script in one html field, but when I click in button don’t populate number field.
    <script>
    jQuery(document).on(‘click’, ‘[id*=”fieldname25_”]’, function(){
    var bmin= jQuery(‘[id*=”fieldname41_”]’).val()*1;
    jQuery(‘[id*=”fieldname27_”]’).val(bmin).change();
    });
    jQuery(document).on(‘click’, ‘[id*=”fieldname26_”]’, function(){
    var bmax= jQuery(‘[id*=”fieldname42_”]’).val();
    jQuery(‘[id*=”fieldname27_”]’).val(bmax).change();
    });
    </script>

    fieldname25 and fieldname26 are a button
    fieldname41 and fieldmane42 are calculated fields
    fieldname27 is a number field

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    Please, include the link to the webpage where the form is inserted, I need check the code running.

    Best regards.

    Thread Starter malpica

    (@malpica)

    Plugin Author codepeople

    (@codepeople)

    Hello,

    The issue is simple, you have defined the fieldname27 field as a number field with the dot (.) as decimal separator, but the calculated field uses the comma symbol (,) as decimal separator, so, when you try to assign the value of calculated field to the number field, won’t be possible because it is not a valid number.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘jquery val’ is closed to new replies.