5 ตุลาคม 2554 8:08
I have an infopath form that is a content type in SP2007 form library. I submit this form programmaticaaly to the form library. I want to add a button to the form to perform save instead of using the save button in form as I want to close the form after saving I tried using the option of saving programmatically and adding this.activewindow.close but it gives error and when I searched I found that this function can't be called in save event so I want to add a button to save and close. I found some ideas of using xdocument but I couldn't get it into the code. I don't know if there is a directory missing or what so kindly advise how can I achieve this.
Thanks in advance.
5 ตุลาคม 2554 15:16
add a button to your form and use action: rules and custom code, where you can do many actions. One is to submit your form and the other one is to close the form.
You may need to uncheck "Allow users to submit this form" in Tools - Submit Options" by menu.
For sure, you can also hide several other submit related default menus/buttons.
9 ตุลาคม 2554 6:48
The form is already submitted to the library and I'm already using the method you mentioned. What I want is to add a button to save changes after the form has been submitted and if I used the submit option, it will give an error as the form already exists so kindly advise.
Thanks in advance.
12 ตุลาคม 2554 6:41
12 ตุลาคม 2554 7:01
I think this won't help in my case as I have the file name as a combination of some fields that user can change during editing and so a new file will be created if I used the submit functionality so I want to save. I want to know how to use the Xdocument.
Thanks in advance
1 กุมภาพันธ์ 2555 20:35
Simple answer to this one.... just add a button and add a rule that is 'When this button is clicked..." then choose 'Close Form'. if any data has changed in the form the user will be prompted to save the form first (it will default save to the location that it was opened from.
in my case i created a Change Request form that goes through a workflow of management approvals. once the item is apporved and the work is done, i require my team to open the form back up from the sharepoint approved library and add release date, completion code and any notes to the form then save it back to the list. adding the Save and Close button has helped a ton. otherwise they were tending to click submit again which would fire off an unnecasarry workflow again. i am no pro when it comes to infopath so this is the 'simple fix' :) im sure there is other ways to code it though.
- เสนอเป็นคำตอบโดย ThePCDoctorMD 1 กุมภาพันธ์ 2555 20:35
2 กุมภาพันธ์ 2555 14:04
The way I tackle this is to put a field in my main data source for "File Name" (I don't actually display it anywhere on the form). I setup my submit data connection to use this file name and to overwrite existing files. I then add my Submit/Save button to the form and put some rules on it. I put in a rule to set the "File Name" field using whatever combination of fields needed, I also put a condition on this rule so that it only runs when the "File Name" field is blank (this stops the file name changing later). Then I put in a rule to run after to submit the form using the data connection. I usually also then put in a rule to close the form but that may or may not suit your needs.
This all means that the first time the user presses Save/Submit it will generate the file name, and save to library. On any subsequent presses, it will just save back to the library with the previously set file name.
If needed, it can often be helpful to add multiple save/submit buttons with variations on the rules above and use conditional formatting rules to only show the correct one at any given time based on other values in the form.
As a best practice I also go into the form options an untick the box to show InfoPath command on the ribbon or toolbar. This means users can only save/submit via your buttons and with your logic.
5 กรกฎาคม 2555 14:36
I know this thread is for 2007 and earlier, but the same problem exists in 2010, which is how I found this thread. In 2010, the option to prompt for save on close is greyed out in the Rule Details dialog for browser-enabled forms. If you're using InfoPath's form filler client that is a valid option though.
For my browser form I opted for the hidden filename field option that Steven described above. If there is another way to do it in 2010, I haven't found it, so this was a great help. Thanks Steven!
- แก้ไขโดย Ted Lewis 5 กรกฎาคม 2555 14:41