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

Question

Question

How to Insert Variable as footer in Laserfiche Forms

asked on March 31, 2021 Show version history

Dear All

We are having Laserfiche forms professional 10.4 we are developing new forms , and We would like to use the footer when save to repository the footer has to be variable , which is in the form , I am very new java script and with the help of laserfiche answers I found the solution as to use the java script as
 

$(document).ready( function ()  {
     $('<footer style="position: fixed; bottom: 0"><p>ENTER YOUR TEXT</p></footer>').insertAfter($('.cf-formwrap'));
});

But in here  i need to put variable value , I created custom html , i put the variable in custom html and given the class as test and  use the code 

$(document).ready( function ()  {
     $('<footer style="position: fixed; bottom: 0"><p>($('.test').text());</p></footer>').insertAfter($('.cf-formwrap'));
});

but unfortunately the values are not showing, in the custom html the values are showing but not in footer ,am I missing something or  am I totally wrong . or I can bring the variable using ($('.#q123').val()); but that also not working 

Thanks in advance 

0 0

Replies

replied on March 31, 2021

Your line 2 has some syntax errors.

First, we want the item with the cf-field class from within the item with the test class.

  • On a live form you would refererence the input/select/textarea element and it's value, like this:
    • $('.test input').val()
  • But on the archive/read-only form you would instead reference the cf-field class and it's text, like this:
    • $('.test .cf-field').text()

 

Second, you are trying to concatenate 3 strings without the proper closure of quotes and the concatenate function (Javascript uses the + character for concatenate).  Here's the 3 strings we need:

  1. '<footer style="position: fixed; bottom: 0"><p>'
  2. $('.test .cf-field').text()
  3. '</p></footer>'

 

Put it all together and it looks like this: 

$('<footer style="position: fixed; bottom: 0"><p>' + $('.test .cf-field').text() + '</p></footer>').insertAfter('.cf-formwrap');

 

Of course, you may want to play around with the appearance a little bit, because it comes out like this for me:

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

Sign in to reply to this post.