• Resolved rphrus

    (@rphrus)


    Hi,
    I have a long calculated field result which got cut off when viewing on mobile phone. The result in the field doesn’t flow to the next line, instead it got cut off on the right. Please show me how to do it.

    Thanks

    • This topic was modified 4 years, 7 months ago by rphrus.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @rphrus

    The solution in this situation would be to use the calculated field as auxiliary, but display the result into another field.

    I’ll try to describe the process with a hypothetical example:

    Assuming your current equation is: fieldname1+fieldname2

    1. Insert a “HTML Content” field in the form with a div tag as its content where will be displayed the equation’s results. For example:

    <div class="result-here"></div>

    2. Edit the equation as follows:

    
    (function(){
    var result = fieldname1+fieldname2;
    jQuery('.result-here').html(result);
    return result;
    })()
    

    3. Finally, as the calculated field is being used as auxiliary, you can hide it by ticking the checkbox: “Hide Field From Public Page” in its settings.

    Best regards.

    Thread Starter rphrus

    (@rphrus)

    My fieldname2 is enter weight in pounds.
    Here’s my equation:
    IF(AND(fieldname2),(function(){
    var f2 = fieldname2;
    if(f2<11) return ‘no dose indicated for this weight’;
    if(f2>=11&&f2<=17.6) return ‘atovaquone 31.25mg/proguanil 12.5mg (one-half of pediatric tablet).’;
    if(f2>17.6&&f2<24.2) return ‘atovaquone 46.87mg/proquanil 18.75mg (three-quarters of pediatric tablet).’;
    if(f2>=24.2&&f2<46.2) return ‘atovaquone 62.5mg/proquanil 25mg (one pediatric tablet).’;
    if(f2>=46.2&&f2<68.2) return ‘atovaquone 125mg/proquanil 50mg (one-half of adult tablet).’;
    if(f2>=68.2&&f2<=88) return ‘atovaquone 187.5mg/proquanil 75mg (three-quarters of adult tablet).’;
    if(f2>88) return ‘atovaquone 250mg/proquanil 100mg (1 adult tablet).’;
    })(),”)

    How can I edit this equation as you stated on # 2 above?
    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @rphrus

    The equation can be implemented as follows:

    
    (function(){
    var result = IF(fieldname2,(function(){
    var f2 = fieldname2;
    if(f2<11) return 'no dose indicated for this weight';
    if(f2>=11&&f2<=17.6) return 'atovaquone 31.25mg/proguanil 12.5mg (one-half of pediatric tablet).';
    if(f2>17.6&&f2<24.2) return 'atovaquone 46.87mg/proquanil 18.75mg (three-quarters of pediatric tablet).';
    if(f2>=24.2&&f2<46.2) return 'atovaquone 62.5mg/proquanil 25mg (one pediatric tablet).';
    if(f2>=46.2&&f2<68.2) return 'atovaquone 125mg/proquanil 50mg (one-half of adult tablet).';
    if(f2>=68.2&&f2<=88) return 'atovaquone 187.5mg/proquanil 75mg (three-quarters of adult tablet).';
    if(f2>88) return 'atovaquone 250mg/proquanil 100mg (1 adult tablet).';
    })(),'');
    jQuery('.result-here').html(result);
    return result;
    })()
    

    Best regards.

    Thread Starter rphrus

    (@rphrus)

    Works!
    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘result got cut off when viewing on mobile phone’ is closed to new replies.