You are viewing limited content. For full access, please sign in.



Populating PDF with variable from HTML

asked on July 21

Hi All,

I am trying to create a form that has a section where the user's name needs to be populated. 

  • For example...As an employee of the City, I, LegalName...


Since the employee has to provide their employee ID, the plan is to populate LegalName via a lookup.

With help from our VAR, the name is displayed in the form when it is on screen, but when the PDF is sent via email and saved to the repository, the name is no longer present, only LegalName.

In the HTML, LegalName was replaced with <span id="LN">LegalName</span>

The JavaScript is as follows:

    $(document).ready(function () {

    //When the Field 25 receives input, it will replace the HTML placeholder
    $("#q25 input").change(function(){

    var value = document.getElementById('Field25').value;


Field 25 being the field that is populated from the lookup. 

The rest of the form contains a Signature and date that are outside of the HTML section.  These fields are in the emailed PDF and saved PDF.

Is there a way to have the name written to the PDF within Forms? 

Any help is appreciated - Lowell


0 0


replied on July 21

You're on the right track, but there's a few things you need to account for.

When writing to a PDF the form is created in a Read-Only mode, which you have to adjust your javascript to work with. In this code #q4 is the name field and the custom HTML has a <span class="InfoName"></span> for the data to placed into. If the form is in Read-Only mode you need to find the ".ro" element and grab the .text() instead of getting the val() from an input. 

Also be sure to put the text update into it's own function and to call it on page load since you won't have an input to get updated.

  $(document).on('change','#q4 input', UpdateName);

function UpdateName()
    var readOnly = ($('[name=IsLocked]').val() == 'True');
    var name = ($('#q4 input').val());
    if (readOnly) 
      	name = $('#q4 .ro').text();
    if (name.length <= 0)
        name = "{Name}";


0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.