Wednesday, February 17, 2010

Design your form data source and layout in InfoPath 2003

Design your form data source and layout in InfoPath 2003

Start InfoPath. Design a new blank form.
In the Data Source task pane, add a data source to your form. To do this, follow these steps:
Right-click myFields, and then click Add.

The Add Field or Group dialog box appears.
Type FirstName as the name of the field, and then click OK.
Repeat step a. Type MiddleInitial as the name of the field, and then click OK.
Repeat step a. Type LastName as the name of the field, and then click OK.
Add myFields to your form.
Click Section with Controls.

Back to the top
Design your form data source and layout in InfoPath 2007
Start InfoPath 2007.
Click Design a Form Template, click Blank, and then click OK.
In the Design Tasks pane, click Data Source.
Right-click myFields, and then click Add.
In the Add Field or Group window, type FirstName as the name of the field, and then click OK.
In the Add Field or Group window, type MiddleInitial as the name of the field, and then click OK.
In the Add Field or Group window, type LastName as the name of the field, and then click OK.
Add the myFields group to the form, and then click Controls in Layout Table.
Back to the top
Submit the form data to a SharePoint Services document library
You can use script or the UI to submit the form data to the SharePoint Services document library.

Use script to submit the form data to a SharePoint Services document library in InfoPath 2003
On the Tools menu, click Submitting Forms.

The Submitting Forms dialog box appears.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit box, click Submit Using Custom Script.
Click Open Microsoft Script Editor, and then click OK.

Microsoft Script Editor starts.
Modify the OnSubmitRequest event as follows.

Note You must change the value of the strURL variable to a valid URL in the code. The URL in the following code sample references a server that is named ServerName, a SharePoint site that is named SiteName, and a document library that is named DocumentLibraryName.
function XDocument::OnSubmitRequest(eventObj)
{
// If the submit operation is successful, set
// eventObj.ReturnStatus = true.
var fSuccessful = false;

// Set the URL of the file that you want to submit here.
var strUrl = "http://ServerName/SiteName/DocumentLibraryName/testform.xml";

try
{
// Create an xmlhttp object.
var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP");

// See whether the document with the same name already exists in the Windows SharePoint Services (WSS) document library.
oXmlHttp.Open("HEAD", strUrl, false);
oXmlHttp.Send();

// No document with the URL has been found. Continue to submit.
// If you must replace the original file, you must call
// oXmlHttp.Open("DELETE", strUrl, false) to delete the document
// in the WSS document library.
if (oXmlHttp.Status == 404)
{
// Put the document in the WSS document library.
oXmlHttp.Open("PUT", strUrl, false);
oXmlHttp.Send(XDocument.DOM.xml);

// A 200 status code or a 201 status code indicates that the form has been submitted successfully.
if (oXmlHttp.Status == 200 || oXmlHttp.Status == 201)
{
fSuccessful = true;
}
}
}
catch (ex){}

if (fSuccessful)
{
XDocument.UI.Alert("Document submitted successfully.");
eventObj.ReturnStatus = true;
}
else
{
eventObj.ReturnStatus = false;
}
}
Save the script. Close Script Editor.
Save your form template as SubmitToWSS.xsn.
Use the UI to submit the form data to a SharePoint Services document library in InfoPath 2003 Service Pack 1
On the Tools menu, click Submitting Forms.

The Submitting Forms dialog box appears.
In the Submitting Forms dialog box, click Enable Submit commands and buttons.
In the Submit to section, click SharePoint form library.
In the Submitting Forms dialog box, click Add.

The Data Connection Wizard starts.
Input your SharePoint Services form library link in the SharePoint form library box.

Your library link may look similar to the following:

http://ServerName/SiteName/DocumentLibraryName
Type the document name in the File name box.

You can use a document name such as TestForm.

Click Next.
In the Data Connection Wizard, click Finish.
In the Submitting Forms dialog box, Click OK.
Save your form template as "SubmitToWSS.xsn."
Use the UI to submit the form data to a SharePoint Services document library in InfoPath 2007
On the Tools menu, click Submit Options.

The Submit Options dialog box appears.
In the Submit Options dialog box, click Allow users to submit this form.
Click to select the Send form data to a single destination check box.
In the drop-down list, click SharePoint Document Library.
In the Submit Options dialog box, click Add.

The Data Connection Wizard starts.
Type your SharePoint document library link in the Document Library box.

Your document library link may resemble the following:
http://ServerName/SiteName/DocumentLibraryName
Type the document name in the File name box.

You can use a document name such as TestForm.
Click Next.
In the Enter a name for this data connection box, type a name for this data connection.
In the Data Connection Wizard, click Finish.
In the Submit Options dialog box, click OK.
Save your form template as SubmitToWSS2007.xsn.
Back to the top
Test your form in InfoPath 2003
On the File menu, click Fill Out a Form.
In the Fill Out a Form task pane, click SubmitToWSS.
Complete the form.
On the File menu, click Submit.

If the form is submitted successfully, you receive a message that indicates this.
Quit InfoPath. If you are prompted to save your changes to the form, click No.
Start Microsoft Internet Explorer. Locate your document form library.

For example, your document form library may be http://ServerName/SiteName/DocumentLibraryName.

A new item that is named testform is in the document library.
Click testform.

The form that you submitted opens in InfoPath 2003.
Back to the top
Test your form in InfoPath 2007
On the File menu, click Fill Out a Form.
In the Fill Out a Form task pane, click SubmitToWSS2007.
Complete the form.
On the File menu, click Submit.

If the form is submitted successfully, you receive a message that indicates this.
Quit InfoPath. If you are prompted to save your changes to the form, click No.
Start Windows Internet Explorer. Locate your document form library.

For example, your document form library may be http://ServerName/SiteName/DocumentLibraryName.

A new item that is named testform is in the document library.
Click testform.

The form that you submitted opens in InfoPath 2007.
Back to the top

No comments:

Post a Comment