Populate Drop-Down List Box on Demand (via code)

M

mac

Hi,

Scenario:
I have an InfoPath form containing drop-down list box, bound to webservice -
InfoPath tries to populate the drop-down on startup. When the user goes
offline, webservice becomes unavailable, so I don't want InfoPath to
populate the drop-down list box automatically as the form opens. Instead,
the user should be able to fill the other data on the form and save it -
when online again, the rest of the data based on the drop-down list box
selection should be appended.

Question:
Is it possible to populate drop-down list box on demand via code (when
button is pushed), not automatically on startup?

Thanks in advance,
mac
 
S

S.Y.M. Wong-A-Ton

Yes. When creating the secondary data source to populate the drop-down list
box, deselect the checkbox "Automatically retrieve data when form is opened".
Then add a button and a rule on the button that queries the data connection
for populating the drop-down list box ("Query using data connection" rule).
Of course you could query the data connection through code too if you wanted
to by using something like (in JScript)

XDocument.DataObjects["<your_data_connection>"].Query();

which will populate the drop-down list box.
 
M

mac

Thanks again, that's what I was looking for!

mac


S.Y.M. Wong-A-Ton said:
Yes. When creating the secondary data source to populate the drop-down
list
box, deselect the checkbox "Automatically retrieve data when form is
opened".
Then add a button and a rule on the button that queries the data
connection
for populating the drop-down list box ("Query using data connection"
rule).
Of course you could query the data connection through code too if you
wanted
to by using something like (in JScript)

XDocument.DataObjects["<your_data_connection>"].Query();

which will populate the drop-down list box.
---
S.Y.M. Wong-A-Ton


mac said:
Hi,

Scenario:
I have an InfoPath form containing drop-down list box, bound to
webservice -
InfoPath tries to populate the drop-down on startup. When the user goes
offline, webservice becomes unavailable, so I don't want InfoPath to
populate the drop-down list box automatically as the form opens. Instead,
the user should be able to fill the other data on the form and save it -
when online again, the rest of the data based on the drop-down list box
selection should be appended.

Question:
Is it possible to populate drop-down list box on demand via code (when
button is pushed), not automatically on startup?

Thanks in advance,
mac
 
S

S.Y.M. Wong-A-Ton

No worries. :)
---
S.Y.M. Wong-A-Ton


mac said:
Thanks again, that's what I was looking for!

mac


S.Y.M. Wong-A-Ton said:
Yes. When creating the secondary data source to populate the drop-down
list
box, deselect the checkbox "Automatically retrieve data when form is
opened".
Then add a button and a rule on the button that queries the data
connection
for populating the drop-down list box ("Query using data connection"
rule).
Of course you could query the data connection through code too if you
wanted
to by using something like (in JScript)

XDocument.DataObjects["<your_data_connection>"].Query();

which will populate the drop-down list box.
---
S.Y.M. Wong-A-Ton


mac said:
Hi,

Scenario:
I have an InfoPath form containing drop-down list box, bound to
webservice -
InfoPath tries to populate the drop-down on startup. When the user goes
offline, webservice becomes unavailable, so I don't want InfoPath to
populate the drop-down list box automatically as the form opens. Instead,
the user should be able to fill the other data on the form and save it -
when online again, the rest of the data based on the drop-down list box
selection should be appended.

Question:
Is it possible to populate drop-down list box on demand via code (when
button is pushed), not automatically on startup?

Thanks in advance,
mac
 

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