General Discussion

  • 1.  Checkboxes on Custom Document?

    Adopter
    Posted 07-16-2024 14:01
      |   view attached

    I'm making custom documents with Handlebars, and I need dynamic checkboxes on my PDF output. 

    I know I can't use <input> fields, and I've tried using unicode via css, with the hope of using conditional formatting to toggle checked vs unchecked states, but that is not working properly (not populating at all). 

    For example, I have a "Pass" or "Fail" question, and I need checkboxes on the PDF that are checked depending on the answer to that question.

    Some of our documents are submitted to the county, and need to be styled very specifically, so this is kind of vital. 

    I have attached a picture of the section in question, I currently have ☐ in my text as placeholders while I try to figure something out.

    Please advise, thanks!



    ------------------------------
    Orin Douglas
    Energy Administrator
    15 Lightyears
    FL
    ------------------------------


  • 2.  RE: Checkboxes on Custom Document?
    Best Answer

    Staff
    Posted 07-16-2024 15:24

    Hi Orin,

    One approach would be to use the IF helper available in handlebars to conditionally render an image of a checked or unchecked box. The handlebars IF helper is described here in our documentation:

    For your template, the code might look something like the following:

    {{#pf:if answers.Result.values.[0] "is" "Pass"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if answers.Result.values.[0] "!is" "Pass"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}} Pass (No Issues) <br/>
                         
    {{#pf:if answers.Result.values.[0] "is" "Pass_w_recommendations"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if answers.Result.values.[0] "!is" "Pass_w_recommendations"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}} Pass (w/ Strong Recommendations) <br/> 
               
    {{#pf:if answers.Result.values.[0] "is" "Fail"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if answers.Result.values.[0] "!is" "Fail"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}}  Fail (Correction Required)</td>

    Hope this helps!



    ------------------------------
    Scott Daly
    Senior Manager, Implementation Services
    TrueContext
    ------------------------------



  • 3.  RE: Checkboxes on Custom Document?

    Adopter
    Posted 07-18-2024 11:29

    This is exactly what I needed, thank you!! 



    ------------------------------
    Orin Douglas
    Energy Administrator
    15 Lightyears
    FL
    ------------------------------



  • 4.  RE: Checkboxes on Custom Document?

    Staff
    Posted 07-18-2024 11:36

    Excellent, glad we could help!



    ------------------------------
    Scott Daly
    Senior Manager, Implementation Services
    TrueContext
    ------------------------------



Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use