Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Filling a form with server-side data before the user fills it out

0 views
Skip to first unread message

Bogdan Dragos HALCIUG

unread,
Oct 3, 2003, 10:53:25 AM10/3/03
to
Joel ,

Would you be so kind to detail the first approach .. and I quote
"1) Dynamically generating the form template (the .XSN file) .."
I've read many times about that , but I have no ideea how to do it.

Scenario:
I can keep in a table all the files that creates in the end an .XSN (cab)
file.
(each column name can be : masifest , script , view1 , sampledata .. etc
.. )
At run time .. I can select wich files will be included in my .XSN then pack
them
and provide them to the user !!?? How that sounds like ??

Or , anyhow I want to be able to dinamycally generate the form-templates .

TIA and keep ON !

--
Bogdan HALCIUG
R&D Developer
L.I.M.S. (USA) INC.
Phone: (954) 964-8663 ext. 33
Fax: (954) 964-8113
bog...@starlims.com
Web: www.starlims.com
""Joel Alley [MSFT]"" <joe...@online.microsoft.com> wrote in message
news:Ff1A4zU...@cpmsftngxa06.phx.gbl...
> This thread is the consolidation of several threads that have been running
> on the same topic. The scenario is this:
>
> A form developer creates an InfoPath form for users to enter their data
> into, and publishes it to a Web Server so the users can access it. When a
> user begins to fill out a form, the form developer wants to automatically
> fill in parts of the form with data. Setting default values in the form
> isn't good enough, because the data will be specific to the user filling
in
> the form, like Business Unit or Cost Center information. How can the data
> be automatically filled into the form when the user opens the form to fill
> it out?
>
> Resolutions
> ===========
> There are four possible resolutions for this question; 1) Dynamically
> generating the form template (the .XSN file) with default data specific to
> the user, 2) Loading data from the server in the OnLoad event of the form
> that fires when the user opens the form to fill it out, 3) Automating
> InfoPath's ExternalApplication object to create a new form based on XML
> data from the server, or 4) Opening a (possibly dynamic) InfoPath form
(the
> XML data file) that contains the server data. You should choose the
method
> that best fits your individual circumstances.
>
> 1) Dynamically generating the form template (the .XSN file) with default
> data specific to the user isn't a great solution because it unnecessarily
> increases network traffic. InfoPath has a built-in caching mechanism that
> makes a local copy of the XSN file the first time the user fills out a
form
> from that template. Thereafter, InfoPath simply checks to see if the
> network copy of the XSN is newer than the one in the cache. If so, it
> copies the new version. If not, it simply uses the cached copy, saving
> some time and network traffic. Dynamically generating the XSN each time
> for each user short circuits this process and forces InfoPath to download
a
> new XSN each time. It also makes the form much harder to maintain in the
> long term.
>
> 2) Loading data from the server in the OnLoad event of the form is a good
> solution because it doesn't short circuit InfoPath's caching mechanism.
> This is a very flexible method. It can be somewhat difficult to implement
> because all of the code must be written in the script editor, which does
> not provide Intellisense. The attached sample demonstrates this method.
>
> 3) Automating InfoPath's ExternalApplication object to create a new form
> based on XML data from the server can be a good solution in certain
> circumstances. It has an advantage over method 2 because the mechanisms
> for collecting the data are not exposed to the user which provides some
> added security. However, because this method typically uses client-side
> script, it is subject to Internet Explorer's ActiveX Security settings.
> Under IE's default settings for the Internet Security zone, this method
> will fail with "ActiveX Component Cannot Create Object". The attached
> sample demonstrates this method.
>
> 4) Opening a (possibly dynamic) InfoPath form (the XML data file) that
> contains the server data is similar to method 3. In this scenario,
instead
> of creating a new form based on existing XML data, we actually open that
> XML data directly in InfoPath. It has an advantage over method 3 in that
> it is not affected by IE's security settings. However, if InfoPath cannot
> acquire a Write lock on the XML file you're opening it will display
> [Read-only] in the title bar next to the file name. (B2TR displays a
> Read-only error dialog. This has been changed in RTM.) This only means
> that InfoPath won't save changes to the XML file back to the original
> location. Saving to a different location or Submitting are not affected,
> but the UI may distract or confuse users. The attached sample
demonstrates
> this method.
>
> The last three possibilities are demonstrated in the attached sample. To
> use the sample, simply
>
> 1) extract the attached zip file into the 'inetpub\wwwroot' directory.
> 2) Then create a virtual directory in IIS for the 'IPDynamicData' folder
> that gets created when you unzip the file.
> 3) Right-click on the 'TwoField.xsn' file in the 'IPDynamicData' folder
and
> click 'Design' to open the form in Design mode.
> 4) On the 'File' menu, click 'Publish'.
> 5) Click 'Next' in the Publishing Wizard.
> 6) Select 'To a shared folder on this computer or on a network' and click
> 'Next'.
> 7) Click the 'Browse' button to pick a location to publish the form to.
> It's in the location we want already, so click 'OK'.
> 8) Click 'Next'.
> 9) For the alternate access path, enter the web address that corresponds
> with the virtual directory (ie. http://myServer/IPDynamicData/TwoField.xsn
> ).
> 10) Click 'Finish' and then 'Close'.
> 11) Click 'Exit' on the 'File' menu to close InfoPath.
>
>
> Loading Data in the OnLoad event
> The TwoField.xsn form has code in its OnLoad event to load data from the
> GetData.asp page if no other data is in the form. To see this at work,
> click Start->Run and enter the path to the form (ie.
> http://myServer/IPDynamicData/TwoField.xsn ). If prompted, click 'Open.
> Notice that InfoPath launches and opens the TwoField.xsn form. Field1 is
> filled with "test field 5" and Field2 is filled with "test field 6", which
> are the values returned by GetData.asp when its 'dataRequest' parameter is
> set to "3".
>
> Loading a Default Form with ExternalApplication.New
> The default.asp page creates client-side script to automate the
> ExternalApplication object to launch InfoPath and then create a new form
> based on the XML data returned by GetData.asp. To see this at work, click
> Start->Run and enter the path to the default.asp page (ie.
> http://myServer/IPDynamicData/default.asp ). Note that the 'Initialize
and
> script ActiveX controls not marked as safe" security setting in Internet
> Explorer must be set to 'Prompt' for this to work. Notice that InfoPath
> launches and opens the TwoField.xsn form. Field1 is filled with "test
> field 3" and Field2 is filled with "test field 4", which are the values
> returned by GetData.asp when its 'dataRequest' parameter is set to "2".
>
> Loading an "existing" form from ASP
> The GetData.asp page actually returns XML in the proper format for
InfoPath
> to open it as a form file. To see this at work, click Start->Run and
enter
> the path to the getData.asp page and pass a 'dataRequest' parameter (ie.
> http://myServer/IPDynamicData/getData.asp?dataRequest=1 ). Notice that
> InfoPath launches and opens the "GetData.asp" form. Field1 is filled with
> "test field 1" and Field2 is filled with "test field 2", which are the
> values returned by GetData.asp when its 'dataRequest' parameter is set to
> "1". This demonstrates how you might have an ASP page that searches for
> data stored in your SQL database and then return that data to be
> redisplayed in InfoPath.
>
>
> Thanks,
> Joel Alley,MCSD


Pierre Greborio [UGIdotNET]

unread,
Oct 6, 2003, 6:38:26 AM10/6/03
to
> 4) On the 'File' menu, click 'Publish'.
> 5) Click 'Next' in the Publishing Wizard.
> 6) Select 'To a shared folder on this computer or on a network' and click
> 'Next'.
> 7) Click the 'Browse' button to pick a location to publish the form to.
> It's in the location we want already, so click 'OK'.
> 8) Click 'Next'.
> 9) For the alternate access path, enter the web address that corresponds
> with the virtual directory (ie. http://myServer/IPDynamicData/TwoField.xsn

What happens if you don't have rights for publishing the template on the web
server but you need to use from there ? If you copy the file you get the
erro message for the original location of the template and you can't open.

Is there any workaround ?

Thanks,
Pierre

--
-------------------------------------------
Pierre Greborio
Microsoft .NET MVP
http://www.ugidotnet.org
-------------------------------------------


Joel Alley [MSFT]

unread,
Oct 6, 2003, 9:58:09 AM10/6/03
to
In step 7, publish the form to a location you do have permissions to. In
step 9, provide the web server address as an alternate access path. When
you fill out the form, you'll have to fill it out from the alternate access
path you provided if you don't want to get the "Form has moved" error
message.

Of course, sooner or later you'll have to get permissions on the final
published directory so you can put the form there.

Thanks,
Joel Alley,MCSD

Pierre Greborio [UGIdotNET]

unread,
Oct 6, 2003, 3:50:51 PM10/6/03
to

Ok, but consider that you could have "read" access rights and not "write" on
a web directiory. So, how can I manage the scenario where the InfoPath
template is available through a web site but you can't publish it from the
URL (only by FTP or xcopy) ?

Thanks,
Pierre

--
-------------------------------------------
Pierre Greborio
Microsoft .NET MVP
http://www.ugidotnet.org
-------------------------------------------

""Joel Alley [MSFT]"" <joe...@online.microsoft.com> wrote in message

news:zdeElHBj...@cpmsftngxa06.phx.gbl...
>
> Thanks,
> Joel Alley,MCSD


Joel Alley [MSFT]

unread,
Oct 7, 2003, 10:11:19 AM10/7/03
to
This is what the alternate access path is for. Use the Publishing Wizard
to publish your form to your desktop through the "Shared Folder" option.
In the Alternate Access Path, enter the web address users will access your
form from. Close InfoPath. Use FTP or XCopy or whatever other method you
want to copy the published form to the virtual directory.

Thanks,
Joel Alley,MCSD

Pierre Greborio [UGIdotNET]

unread,
Oct 8, 2003, 1:11:03 PM10/8/03
to
Thanks a lot for your help
Pierre

--
-------------------------------------------
Pierre Greborio
Microsoft .NET MVP
http://www.ugidotnet.org
-------------------------------------------
""Joel Alley [MSFT]"" <joe...@online.microsoft.com> wrote in message

news:oPPQjzN...@cpmsftngxa06.phx.gbl...

0 new messages