Saving InfoPath 2007 forms in MOSS 2007

M

Miguel Isidoro

Hi,

I have an InfoPath 2007 form template associated with a MOSS 2007 form
library. In this form, I have custom a "Save" button, with an action to use a
data connection that submits data to the hosting environment (in this case
SharePoint). When a user, in the Sharepoint form library, clicks "New", fills
the form and clicks the custom button, the form is correctly saved to the
form library with a name based on the current time and username of the user
who submitted the form. This is exacty what I want. The problems comes with
editing the form. When a user with permissions to edit the form, clicks the
form for editing and clickes the custom button after making some changes, a
new form is created with a new name (based on the current date and username),
instead of updating the form that was opened for editing. What kind of action
do I have to have in the InfoPath form template in the my custom button so
that it performs the same action that the InfoPath "Save" button, saving the
form data to the form being edited instead of creating a new form everytime I
edit the form and click my custom save button?

Thanks in advance,
Miguel Isidoro
 
K

K.Ramana Reddy(GGK Tech)

Hi,

In Custom Save button, You need to check form is new form or existining form.
If Form is New submit the form as a new form
If form is existining form Olny save the changes made by the user
overwriting the existining form.

I hope this will help for you.
 
S

Shiva, GGK Tech

Hi,

You can get the form is new or already submitted by using below the code.

var isNew = thisXDocument.IsNew;

It will gives true if form is opened newly otherwise false. You can set this
value to one field in your form by that way you can know that form is new or
existing one.

Note: If you save the form on your local machine, if you opened local
machine form it will give always ‘true’ value for thisXDocument.IsNew.
 
M

Miguel Isidoro

Hello,

Thanks for the quick response. Just one doubt. Right now, I am submitting
the form without using any code. This change you suggest means that the
submission would be made using code, correct? This would mean that the data
connection I am using to submit the form would not be used anymore and the
submission would be made using code?
If this is correct, what would be the event handler where I would place the
code and what code should I place there? It would be something like

var isNew = thisXDocument.IsNew;
if (isNew)
//submit
else
//save

Please correct me if any of this is not correct.

Thanks
Miguel
 
K

K.Ramana Reddy(GGK Tech)

Hi,

Yes, you are right. you can write this code OnSubmitRequest.
If form is New, you need to Submit the form as new form else you need to
Overwrite the existining form.

I hope this will help for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top