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



HTML on Form Not Displaying on TIFFs

asked on April 12

Hello again! I'm currently using an HTML span tag to dynamically populate someone's name into a paragraph. I have a CSS class titled "PatientName" assigned to a "Full Name" field which is concatenating the First and Last names of the individual, and then I'm using the HTML on an HTML field "My minor child, <span class="xPatientName"></span>, has applied for employment..." in combination with the following JavaScript to dynamically populate that employee's full name into a paragraph of text.

$(document).on("change", ".PatientName", function() {$(".xPatientName").text($(".PatientName input").val()).change();});

The issue I'm having, however, is that while the form is displayed and being actively filled out, everything works perfectly, however when the resulting document is saved to our repository or emailed out to anyone as part of the process, "My minor child, First Last, has applied for employment..." turns into "My minor child, , has applied for employment..."

Is there something I'm missing? Any way to perform this differently so that the concatenated HTML paragraph includes their name, no matter where in the process it's viewed from? Any help would be appreciated!

0 0


replied on April 12

There are two issues here that are not going to work on the readonly version of the form.

  1. It is being triggered by a change event of the field, which isn't going to happen when the form is just loading up from a prior submission.
  2. It is pulling the value from the input element of the PatientName class, but the input elements are replaced with div elements in the readonly version of the form.

There are a couple different ways we can handle this, but here's how I usually do it: 

$(document).ready(function() {
  //function that updates the custom HTML element.
  function UpdateMyHTML () {
    var patientNameValue = $(".PatientName input").val();
    if (patientNameValue == undefined) {
      patientNameValue = $(".PatientName .cf-field .ro").text();
  //Call the function when the form is loaded.
  //Call the function on changes.



2 0
replied on April 12

Thank you so much, Matthew! This seemed to fix the issue on any forms being emailed out as pdfs, but the version saved to our repository still is lacking the name in the paragraph. I don't see how one would behave differently from the other, but they do. Any ideas?

0 0
replied on April 12

Yeah, it really shouldn't be different.  The readonly version of the form should be nearly identical for any of these situations:

  1. Prior submissions viewed on the Monitor page.
  2. Archived copy to the repository.
  3. Emailed copy.
  4. User tasks with the checkbox marked to display the form as readonly.

If it's working for all but #2, then it seems like something else is going on.  Is it the exact same form being used for archival or are there multiple versions of the form and it is a different one being archived?  Is there any other Javascript that could be impacting it?

0 0
replied on April 12

I think I fixed it! Thank you for that explanation though of how all 4 should be treated equally. It was indeed a separate form, however I figured since the variable values were still stored, that field didn't need to be present on the form. I believe I was wrong, because after adding the concatenated "full name" field to the form and then simply hiding it from view with some display:none css, it worked properly! 

I'm far from an expert or even a novice when it comes to javascript so I really appreciate your assistance with this, Matthew!

0 0
replied on April 12

You're very welcome.

0 0


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

Sign in to reply to this post.