Professional InfoPath 2003 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional InfoPath 2003 [Electronic resources] - نسخه متنی

Ian Williams, Pierre Greborio

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید











Integrating with a File System


File system integration is used in many enterprise scenarios. Consider, for example, a network share where another application picks up all files available every hour for processing. This application could be Microsoft Biztalk Server or another process that connects to that directory though the FTP protocol (it is the standard way for mainframe-based architectures).

This kind of integration is probably the most simple. You only have to save the file in the correct directory. However, this assertion isn’t always true. If you remember that InfoPath permits you to save the file even if it is not validated, this could be a serious problem. What happens if you save a wrong or incomplete form on the share and the data is processed? InfoPath advises the user that the form contains errors, but what happens if the user is careless? Depending on the content, that could be a serious issue.

You then have to implement the script code needed to save the file to the right directory. The script should be called during the submit so that InfoPath disables the submission until the form is valid.

If you select Submit using custom script from the Submitting Forms dialog box (see Figure 7-13), InfoPath will create the following code:


function XDocument::OnSubmitRequest(eventObj)
{
// If the submit operation is successful, set
// eventObj.ReturnStatus = true
// Write your code here
}

OnSubmitRequest will be invoked every time the user selects the Submit item menu command or presses the Submit button. The InfoPath Object Model provides a method called SaveAs that permits you to save the document into a given directory:


function XDocument::OnSubmitRequest(eventObj)
{
try
{
XDocument.SaveAs("D:\Temp\MyForm.xml");
eventObj.ReturnStatus = true;
}
catch(e)
{
eventObj.ReturnStatus = false;
}
}

In this way, each time the user submits the form, it is validated before it is saved. As you will see in Appendix C, SaveAs works only if the form is fully trusted, as described in Chapter 10.

/ 166