Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / July 2005

Tip: Looking for answers? Try searching our database.

alphabetize drop down list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
abc - 27 Jul 2005 17:17 GMT
i'm connect to access db...

user is allowed to create new "unit" and clicks refresh to populate
into dropdown list.. is there a way to alphabetize this drop down list
once it re-populates with the "new unit"?
Scott Roberts [MSFT] - 29 Jul 2005 23:16 GMT
Unfortunately, there is no way to sort the list using the InfoPath Designer.  However, you can extract the form files and edit the XSL to make this happen.  You can add xsl:sort to do sorting.  However, you will need to add the xd:preserve attribute to your template so that you will be able to open your Form Template in the Designer without losting your changes.  Here is an example of template that has the xd:preserve attribute (from the InfoPath SDK):

<xsl:template match="my:field1" mode="xd:preserve">
  <div>
     The value of field1 is <xsl:value-of select="."/>
  </div>
</xsl:template>

You would then place all the XSL for the list inside of this template and add the xsl:sort statement in the xsl:for-each for the list.  The xsl:for-each would look something like this:

<xsl:for-each select="my:group1/my:group2">
<xsl:sort select="my:field2" order="ascending"/>
<option>
 <xsl:attribute name="value">
  <xsl:value-of select="my:field2"/>
 </xsl:attribute>
 <xsl:if test="$val=my:field2">
  <xsl:attribute name="selected">selected</xsl:attribute>
 </xsl:if>
 <xsl:value-of select="my:field2"/>
</option>
</xsl:for-each>

I hope this helps.

- Scott

> i'm connect to access db...
>
> user is allowed to create new "unit" and clicks refresh to populate
> into dropdown list.. is there a way to alphabetize this drop down list
> once it re-populates with the "new unit"?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.