• Resolved avcobb123

    (@avcobb123)


    My form is a calculator of sorts where a user enters a value, and several fields populate based on this entered value.

    The fields are all using multiple if statements, similar to this

    (function(){
    if(fieldname2<= 2499) return 150;
    if(fieldname2 <= 4999) return 300;
    if(fieldname2 <= 9999) return 600;
    if(fieldname2 <= 24999) return 1000;
    if(fieldname2 <= 49999) return 2000;
    if(fieldname2 <= 99999) return 3000;
    if(fieldname2 <=249999) return 5000;
    if(fieldname2 <=250000000) return 10000;
    })()

    the issue is that all of my fields are populating based on zero for the field that the user is supposed to enter. I’d like for these to be blank until someone enters a value.

    Is there an easy way to fix this?

    Great plugin BTW!

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @avcobb123

    Please, edit the equation as follows:

    (function(){
    if(!fieldname2) return '';
    if(fieldname2<= 2499) return 150;
    if(fieldname2 <= 4999) return 300;
    if(fieldname2 <= 9999) return 600;
    if(fieldname2 <= 24999) return 1000;
    if(fieldname2 <= 49999) return 2000;
    if(fieldname2 <= 99999) return 3000;
    if(fieldname2 <=249999) return 5000;
    if(fieldname2 <=250000000) return 10000;
    })()

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘How To Set Values As Blank To Begin With Conditional Fields?’ is closed to new replies.