• Resolved lucavanon

    (@lucavanon)


    Hello,
    great plugin!
    My form calculate the model of a machinery based on given data.
    Everything works great and I have at the end a field with the name of the model.
    What I want to do is to add a button to download the datasheet of the selected model so I need to use the result field as an input for a button that trigger an event to download the related datasheet.
    Could you please help me?
    Thanks,

    Luca

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

    (@codepeople)

    Hello @lucavanon

    The solution would depend on your project.

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

    Assuming your current equation is: fieldname1+'-'+fieldname2 and this value corresponds to the name of the xls file located in the URL: https://www.yourwebsite.com/model/…., for example: https://www.yourwebsite.com/model/12-34.xls

    So, in this hypothetical case, you can:

    First, insert a “HTML Content” field with a DIV tag as its content, where display the download button:

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

    Second, edit the previous equation as follows:

    
    (function(){
    var result = fieldname1+'-'+fieldname2,
        url = 'https://www.yourwebsite.com/models/'+result+'.xls';
    jQuery('.button-here').html('<input type="button" value="Download" onclick="'+url+'">');
    return result;
    })()
    

    and that’s all.
    Best regards.

    Thread Starter lucavanon

    (@lucavanon)

    Perfect! That’s exactly what I was looking for, thanks.
    Just another question: I have a calculated field that returns a string, not a number, but when I refer to this field in another calculated field it get only the number part of the string, is it a normal behaviour?
    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @lucavanon

    By default the plugin will try to extract the numbers from fields’ values, to use them in the mathematical operations. If you want the values without preprocessing, use the modifier |r (for raw) as part of fields names.

    Returning to the previous example: fieldname1+'-'+fieldname2, if you want to use the raw values of fieldname1 and fieldname2, the equation should be edited as follows:

    fieldname1|r+'-'+fieldname2|r

    and that’s all.
    Best regards.

    Thread Starter lucavanon

    (@lucavanon)

    Perfect!
    Really love your plugin, and great support.
    Thanks

    Plugin Author codepeople

    (@codepeople)

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Use another field for an event of a button’ is closed to new replies.