Listbox Position

B

Brian Teutsch [MSFT]

InfoPath gives you access to the data stored behind the controls, but not
any properties within the control. I'm curious why you are looking to get
the index, though. In Service Pack 1, we introduced a "Filters" feature that
maps to the main reason to use indices.

Thanks,
Brian
 
H

Hagen Green [MSFT]

You technically *could* get the selected list box item, but it wouldn't be
very easy. If you choose to try it, count on at least a few hours of work to
get it right :).

1. In the OnAfterChange event, load the XSL (i.e. view1.xsl) into a DOM.
2. Run an xpath on the XSL looking for the listbox. You'll need some
selection criteria. Best thing to use might be the xd:binding and the fact
that it will be an xhtml:select element.
3. Select all children nodes of the xhtml:select. These are the items in the
list.
4. Find the item whose value (not display name) is the same as the DOM's
value for the listbox's bound node.
5. (Trivial) determine the count of the item you found by looking at the
number of previous siblings.

One thing I did in the past (that was kinda fun) was to determine
programmatically which view had a validation error. I had to walk all .xsl
view files in the solution to determine which one mapped out to a specific
error. Lots of fun :)

--Hagen
This posting is provided "AS IS" with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm
 
J

J_A_Z_Z

Hagen Green said:
You technically *could* get the selected list box item, but it wouldn't be
very easy. If you choose to try it, count on at least a few hours of work to
get it right :).

1. In the OnAfterChange event, load the XSL (i.e. view1.xsl) into a DOM.
2. Run an xpath on the XSL looking for the listbox. You'll need some
selection criteria. Best thing to use might be the xd:binding and the fact
that it will be an xhtml:select element.
3. Select all children nodes of the xhtml:select. These are the items in the
list.
4. Find the item whose value (not display name) is the same as the DOM's
value for the listbox's bound node.
5. (Trivial) determine the count of the item you found by looking at the
number of previous siblings.

One thing I did in the past (that was kinda fun) was to determine
programmatically which view had a validation error. I had to walk all .xsl
view files in the solution to determine which one mapped out to a specific
error. Lots of fun :)

--Hagen
This posting is provided "AS IS" with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm

Hagen,
finding which view has a validation error is another problem im
trying to solve, can you send me more information on this? I havent
found any info on it.
 

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