2 Replies Latest reply on May 26, 2011 5:10 AM by MaxCompana

    Populate form fields using DataConnection and SQL query

    MaxCompana

      Hi. I have a local database. I can connect to it from my form which has several text fields binded to the DataConnection fields.

      The idea is to locate a certain record in the database and fill these fields with corresponding values.

      I have a button whith defined click event with the following simplest script 

       

      -------------------------------------------

      topmostSubform.Page1.Button1::click - (JavaScript, client)

       

      xfa.sourceSet.DataConnection.resolveNode("#command").query.commandType = "text";

       

      xfa.sourceSet.DataConnection.resolveNode("#command").query.select

      = "SELECT * FROM records WHERE InternalID = '000-00-0024'";

       

      xfa.sourceSet.DataConnection.open();

      -------------------------------------------

       

      No errors or warnings, but the fields are not updated with new values (those are set with the first record of the table).

      The event handler works - I tried to execure some code in there.

       

      If any ideas how to fix it please drop me a line.

      Thanks,

       

      MaxCompana