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

    Form prepopulation java query not working properly

    Asked by bltrecruiting on December 18, 2014 at 02:04 PM

    I have connected my form submission thankyou.php to mysql, everything works fine.

    Now, I have a box on my form that queries mysql client_name column, if a match is found (with limit 1) then the form should autopopulate with the corresponding fields.

    SO for example, if client Microsoft is already in the database, I want the address, phone number etc fields for Microsoft to autofill.

    I've got the array printing out and all the data is fetched, however the java script that populates the form with the array is not working properly - I am using one field as a test (Attn_Email1) but hoping to add more fields if I get this working.........

    Client_Name should be populated by the entry in the search box - $regnum if you look at the code this will make sense.

    The two field names (taken from URL source) are {name7} for `Client_Name` and {name} for `Attn_Email1`

    Is it because the names are closely matched i.e. name & name7? I have tried changing field names but it makes no difference.

    If you look also, the name Jones is in the Attn_Email1 field of MYSQL DB on the first row. There being 5 rows of dummy data in MYSQL DB however, any name I put in for Client Name query  the javascript only puts the result for Attn_Email1 from the first DB row into the form, and puts it in the wrong field (it puts it in Client Name - first box in form despite me telling it to put $regnum there)

    I have checked and checked the URL source form field names over and over and they are correct.

    Please help if this doesn't work I am going to need to migrate away from Jotform & I really don't want to. 

     

    Please see my code http://pastie.org/9788625

     

    Page URL:
    http://recruitingblt.comli.com/add-new-sales-record.html

    Screenshot
    prepopulation JotForm source name phone number
  • Profile Image
    JotForm Support

    Answered by Welvin on December 18, 2014 at 03:42 PM

    Hi,

    My colleague Ben gives you his best to your first thread regarding the same matter. I think you already received it. Kindly check: http://www.jotform.com/answers/478206

    Thank you!