Form prepopulation java query not working properly

  • Profile Image
    bltrecruiting
    Asked 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

     

  • Profile Image
    Welvin
    Answered 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!