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

Question

Question

Javascript to create footer using variables from Form?

asked on August 2, 2019

From other posts, I gathered this Javascript to create a footer upon saving to Laserfiche.  Why did this not work?

$(document).ready( function () {
  $('<footer style="position: fixed; bottom: 0"><p>Final Page of Toolbox Meeting for {/dataset/crew_1}-{/dataset/date}</p></footer>').insertAfter($('.cf-formwrap'));
});

 

RESULT ON THIRD PAGE (Originally, I wanted a Page # on each page, but settled for this):

0 0

Replies

replied on August 2, 2019

Your JavaScript is assigning plain text to the footer value not variables, so technically it did what it is configured to do, just not what you wanted to happen.

{dataset/} variables do not work that way in JavaScript as they are only meant to fill in page content when the form loads.

Instead, you need to use JavaScript to retrieve the actual field values and use those to build your string.

1 0
replied on August 8, 2019

Thanks, Jason.  So, how would you build this?  Could you give me an example of the JavaScript you would use?

0 0
replied on August 8, 2019

Well that really depends. If this is for the copy saved to the repository, then you have to treat it differently.

First, you need to get your variable values.

// you would use div[type="text"] instead of input for save to repository because it will no longer be an input at that point 
var myText = $('.myField div[type="text"]').text();

Then you can use that to build your footer text.

var footerText = 'Final Page of Toolbox Meeting for' + myText + '-' + myDate;

 

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

Sign in to reply to this post.