Checking if the form was saved - InfoPath Dev
in

InfoPath Dev

Checking if the form was saved

Last post 03-06-2007 11:58 AM by Greg Collins. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-05-2007 03:53 PM

    Checking if the form was saved


    Hello again,

    Can someone tell me how I can tell if a form has been saved since it was opened? Is there something similar to the isDirty() function I could call to check this or should I just do whatever I need to do once a form was saved in the onSaveRequest event handler ?

    To explain why I'd like to find out.
    I'm currently working on a project that will save Infopath form data to a SQL Server database. Once a form has been saved I need to do a query on one of the tables to retrieve a value, which then needs to be written to another table (the queried value is used to make up a product identifier in the end).

    I'd like to do as little querying in code as possible (simply because I am not familiar enough with how Infopath handles that kind of thing) but I can't see a way around this. I was initiall thinking I could use the last insert id as a guide but I haven't been able to find anything in regards to this for Jscript.

    All a bit confusing really, especially seeing as I am comfortable with SQL server stuff when doing general web-dev.

    Again, any hints would be MUCH appreciated as this project is important to me.

    cheers,
    Ben
  • 03-05-2007 03:56 PM In reply to

    Re: Checking if the form was saved

    You might use the OnSaveRequest event to set a variable or field stating that a save has occurred.
  • 03-05-2007 04:36 PM In reply to

    Re: Checking if the form was saved

    Thanks for the quick reply Greg, appreciate it.

    In regards to the save question in general, is there a way to
    tell if Infopath has inserted/updated the data in SQL, before the
    form XML is saved? Or is that all being done at the same time?
    (Sorry, being a bit "dense" this morning)

    cheers,
    Ben
  • 03-06-2007 09:57 AM In reply to

    Re: Checking if the form was saved

    Are you actually going to save the form or is it just used to save the data. For SQL Data forms I usually do not save the form as an indivdual copy but just use it to update the live data. I use the method Greg suggests and have a flag field that updates after the submit. If you use the default submit functionality of InfoPath you can have custom messages regarding success or failure of the data submit. I often use custom rules to do the submit funstions. In that case if you have the flag update after the submit rule completes you know whether it was successful since if it fails no more rules are completed and the flag would not get updated. Again if you use rules to control the data submit and then the form submit you can control or monitor the process better. However if you are allowing them to save forms themselves ad hoc then there is not much you can do to control the process. This is why I disable the ability for users to save the forms directly and they must submit to the database and then to sharepoint if necessary since this can be conrolled with rules or programatically.
    I believe there is some code functions regarding data connections and submit that has an error function but it has been a while since I have looked at it.

    Clay
  • 03-06-2007 11:58 AM In reply to

    Re: Checking if the form was saved

    If you want to know whether any data connection has been updated, you need to keep track of that yourself. You will need to do this is code or rules. If you use rules, you need some kind of a boolean field tha you can update in your rule actions after you've updated the data connection (SQL or whatever). If you use code, you would do something similar, except you can use a variable or a field value, which ever you prefer.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.