October 2009 - Posts - Greg Collins
in

InfoPath Dev

This Blog

Syndication

Greg Collins

October 2009 - Posts

  • Swap the AD Alias and Name Fields in Place

    In this tutorial you will learn how to use perform an in-place swap of an Active Directory alias and display name so as to conserve space in the view. This sample uses a text field and a button along with conditional formatting, rules and data validation to keep things running smoothly.

     

     

    While this solution is not for everyone, it will come in very handy for some of you with tight space requirements.

    Start a new form:

    1.       Create a new blank form.

    2.       Add a Receive data connection to the GetUserInfo method of the Qdabra AD Web Service.

    a.       Set it to NOT automatically retrieve data when the form is opened.

     

    Create the schema:

    1.       In the Data Source task pane, add the following text fields: Title, Subtitle, Author, Coauthor, Year, and Description.

    2.       Add the following text and Boolean attributes to Author and Coauthor schema nodes: displayName, isEditing (default to TRUE).

     

    Design the view:

     

    1.       Drag myFields into the view and select Controls In Layout Table.

    2.       Edit the properties for both Author and Coauthor fields to:

    a.       Add data validation to show the ScreenTip “Invalid Alias” when isEditing is FALSE and displayName is blank and respective Author and Coauthor is not blank.

    b.      Add a rule to set the GetUserInfo username query field with the value from Author and Coauthor respectively.

    c.       Add a rule to query GetUserInfo.

    d.      Add a rule to set displayName with Value (from the GetUserInfo data connection) filtered on Key=“displayName”.

    e.      Add a rule to set isEditing to “false”.

    f.        Add conditional formatting to hide the field when the isEditing is FALSE and displayName is not blank.

    3.       Add buttons below the Author and Coauthor fields in the table and edit their properties to:

    a.       Set the respective label with the values of the Author/displayName and Coauthor/displayName.

    b.      Name the respective ID value to btnEditAuthor and btnEditCoauthor.

    c.       Add a rule to clear the respective Author and Coauthor value.

    d.      Add a rule to set the respective isEditing to “true”.

    e.      Add conditional formatting to hide the button when the respective isEditing is TRUE.

    f.        Add conditional formatting to hide the button when the respective isEditing is FALSE and displayName is blank.

    g.       Set the width to 100%.

     

    Preview the form and test. You can apply other formatting to the button as you like, such as removing the border and background shade, and manually left-justifying the text in the expanded view .XSL file.

     

     

    You can download the sample form I created for this article from here: http://www.infopathdev.com/files/folders/examples/entry47771.aspx

Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.