Infopath 2003 - Submit to DB, Create New, Carry over specified values. - InfoPath Dev
in

InfoPath Dev

Infopath 2003 - Submit to DB, Create New, Carry over specified values.

Last post 01-24-2008 02:16 AM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-19-2008 02:26 PM

    Infopath 2003 - Submit to DB, Create New, Carry over specified values.

    Using Infopath 2003 and JScript

    I have built a form which submits to a MS Access DB. 
    I added two buttons: submit1 and submit2
    submit1 works properly, it submits to DB and clears form.
    submit2 i am trying to get to submit to DB and clear only specified fields leaving others as defined before submit2 was triggered.  I tried to use XDocument.Submit() and then manually setting each field to "" via DOM SelectSingleNode.  What happends is that submit2 clears the fields properly but then the next submit doesnt create a new row entry rather it updates the first entry. 
    Basically I'm seeking to submit to DB then carry over certain values to a new form.  Thanks in advance,
    Luke Slotwinski

     

    Filed under: , ,
  • 01-21-2008 07:31 AM In reply to

    Re: Infopath 2003 - Submit to DB, Create New, Carry over specified values.

    After the submit it sounds like you would want to create a new record or row. then you would copy the data from the previous row to the new one to "seed" you values.

    It sounds like this is the step you are missing or you are not referencing the new row properly.

    I beleive there are some blog examples, here on the site, on how to use an exisitng row as a template and to copy a record as a new record.

  • 01-23-2008 09:07 PM In reply to

    Re: Infopath 2003 - Submit to DB, Create New, Carry over specified values.

    I searched the web for hours trying to find a good solution to the problem.  This site had several people who ran into the exact same thing I was trying to do, however noone resolved it completely. 
    Problem is, the New Record Infopath functionality resets the DOM, allowing for a new DB submission.  I saw one person had a solution by assigning his fields into query fields, resetting the form, and brinign them back.
    What I ended up doing to resolve this issue is declaring global variables in JScript; I built a button triggered function which assigned the form fields to those global variables, then submit the form, and switched a temp view which only had a success message and a new record button.  Click the New Record button, resets the DOM and brings the user back to the default view of the form.  There I had another function button which defined the form values with the global variables. 

     Hope this helps anyone in the future looking to carry values over to a new form. 

  • 01-24-2008 02:16 AM In reply to

    Re: Infopath 2003 - Submit to DB, Create New, Carry over specified values.

    Hi Luke and thanks for the solution.

    I'm pretty sure there is a way to set it so that you can fool the DOM into thinking it is new without clearing all of the data elements.

    Another approach is to just remove the xdado element from the DOM.

    Here's an exercise: create a sample form that queries and submits to a DB table. Previewed and enter some values, click submit. File-Save this form to c:\temp and call it "form1.xml". Next, click New Record and save the XML to your c:\temp folder as "form2.xml". Run windiff on these two files and notice that the difference is the <xdado...> element at the bottom of the xml.

    So, all you need to do is add a button that removes that element from your form and the rest of the data will not be affected. I'll leave the removal of that node (simple xpath) as an exercise for you... :)

    Cheers!

    Related post: http://www.infopathdev.com/forums/p/7091/25890.aspx#25890

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.