What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Can I create a form that downloads a PDF if the user has put in the correct file name to download?

    Asked by paineelectronics on May 29, 2014 at 01:06 PM

    Is it possible within jotform to download a file from a website based on a validated file name?  We have customers that request specific files and it would be nice if they could just fill out a form and if the file name was correct, the appropriate pdf opened.  Is this possible?

    name and JotForm fill download pdf PHP
  • Profile Image
    JotForm Support

    Answered by TitusN on May 29, 2014 at 03:04 PM

    Hello,

    Yes - this is possible.

    It depends on the following:

    1. How many PDF's we are talking about

    2. Do they have to know the file name?  - can't they select from a drop-down list - or what do you have in mind?

    3. Whether the PDF's are uploaded to a web-repository for easy download

    But in General - yes, this is very possible.

    Please clarify the questions above and we shall adivice further.

  • Profile Image

    Answered by paineelectronics on May 29, 2014 at 03:19 PM

    It would be 1 pdf per request.  They would need to know the exact name of the file and.... the files are all located in a central directory within our web directory.  We are trying to replace our old data request system with a much simpler process that does not rely on Office dll's. (http://www.paineelectronics.com/electroniccaldata.aspx)  

  • Profile Image

    Answered by EliezerN on May 29, 2014 at 05:11 PM

    As my colleague already stated, what you are looking for is completely achievable.

    This can be accomplished by using conditional logics and using our Form Calculation widget. That way the URL of the PDF file will be populated in the Calculation box depending on the name chosen/entered.

    Please take a look at this sample form: http://form.jotformpro.com/form/41486068162962

    A different URL for a pdf file wil be populated on the Get your PDF URL field depedning on the name chosen.

    To accomplish that simply follow these steps: 

    1. Add a Dropdown field (or a text box if you wish) and add the list of the names of your PDF files.

    2. Then add a Form Calculation widget:

    3. Then, proceed to create the conditions that will populate the PDF URL on the Form Calculation box depending on the Name that was selected.

    Here is the animation to know how to create the conditions:

    https://shots.jotform.com/eliezer/jotform%20gifs/conditions%20to%20populate%20widget.gif

     

    Then you have to apply the same proceudure for the other conditions.

    I hope this helps.

    Please inform us if you need further assitance with this query.

    Thanks

  • Profile Image

    Answered by paineelectronics on May 29, 2014 at 05:31 PM
    The challenge for us and for our customer’s security, is that we cannot have a populated list.  We have to have a field that a customer types his or her number(s) into that then compares itself to a file name within a directory.  If that name is found, the appropriate pdf is opened (specific to that one customer).  We currently do this with a heck of a lot scripting and it's a pain.  Our thought was that if we could design a simple form entry that could compare and then open a document, a whole world of opportunities could unfold for our customers.
  • Profile Image
    JotForm Support

    Answered by jonathan on May 29, 2014 at 09:49 PM

    Hi,

    How about if you instead use the form Send Post Data feature?

    User Guide: How-to-Post-Submission-Data-to-Thank-You-Page

     

    You can use the post data from the user provided filename (from the input field), and then use server side query to search the filename in your directory list.

    I found on the internet a solution that I think should work on what you require here.

    http://stackoverflow.com/questions/3321547/help-using-regexiterator-in-php

    To summarize, the design I have in mind is like this.

    1. Create your input form. Make sure to setup question for the filename data needed (a Textbox will do)

    2. Enable Send Post Data method in the form.

    3. In the form's Custom Thank you URL, redirect it to your PHP web page.

    4. Your PHP webpage should have a query code similar to what I was suggested here

    5. Once the correct filename output is captured, you can redirect the page again to the form or thank you page where the file URL path/link is now available for the form respondent to download.

    Please tell us if this solution can work for you.

    We can also provide you further assistance on the server side PHP code needed, should you like to proceed using this method.

    Thanks!

  • Profile Image

    Answered by paineelectronics on August 12, 2014 at 02:52 PM

    Unfortunately, this level of programming is beyond our capabilities.  Sure wish there was a simpler process.  Thank you for the input :-)