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

Question

Question

How can i add a pdf link to a form?

asked on July 1, 2014

i need to find out a way a pdf link to appear when a selection is made.  for example:  if yes to option 1, pdf link appears.  if yes to option 2, different pdf link appears.  or is there a way to send a pdf as an email depending on which option is selected?

 

0 0

Replies

replied on July 1, 2014

Where are the PDFs hosted? If they're available via a URL, you can use JavaScript to dynamically link to them.

 

Here's an example, assuming you have two radio button fields for your options (given the option1 and option2 CSS classes).

 

$(document).ready(function () {
    $('.option1').change(function () {
        if ($(this).find('input:checked').val() == "Yes") {
            $('<p class="link1"><a href="www.google.com">This is a test</a></p>').insertAfter(this);
        } else {
            $('.link1').remove();
        }
    });

    $('.option2').change(function () {
        if ($(this).find('input:checked').val() == "Yes") {
            $('<p class="link2"><a href="www.google.com">This is a test</a></p>').insertAfter(this);
        } else {
            $('.link2').remove();
        }
    });

});

For each option's block of code, you'll update this line with the correct PDF location and link text:

 

$('<p class="link1"><a href="www.google.com">This is a test</a></p>').insertAfter(this);

You could use Workflow to send the correct PDF as an email attachment.

0 0
replied on July 1, 2014

the pdf's are hosted locally on my computer and on the server.   i dont have access to upload pdf's to our website.  any other way?

0 0
replied on July 1, 2014

You could put the PDF on the Forms Server and access them. I put them in C:\Program Files\Laserfiche\Laserfiche Forms\Forms\img.

 

$(document).ready(function() {
  $('.option1').change(function() {
    if ($(this).find('input:checked').val() == "Yes") {
      $('<p class="link1"><a href="http://FormsServer/forms/img/41.pdf" target="_blank">This is a test</a></p>').insertAfter(this);
    } else {
      $('.link1').remove();
    } 
  });
  
    $('.option2').change(function() {
    if ($(this).find('input:checked').val() == "Yes") {
      $('<p class="link2"><a href="http://FormsServer/forms/img/41.pdf" target="_blank">This is a test</a></p>').insertAfter(this);
    } else {
      $('.link2').remove();
    } 
  });
  
});

Replace FormsServer with the Forms Server machine's name.

1 0
replied on July 2, 2014

thank you that worked.....

0 0
replied on July 2, 2014

Hi there,

 

Can you tell me more about your use case? What kind of process you are making? Why needs PDF file to be there?

 

Thanks,

0 0
replied on July 2, 2014

the form i am currently working on is an fmla- employee request for leave form.  the reason why i need to link a pdf to the form is because if you select any of the 4 options listed on the form there needs to be a document filled out by the doctor.  so the option is selected a link for the required paperwork shows up in another tab, user can then email, save, or print document then bring it back to the HR department when they return from their leave. 

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

Sign in to reply to this post.