Kirk Hofer’s Blog

July 15, 2009

Simple Date Entry for InfoPath

Filed under: Uncategorized — Tags: — kirkhofer @ 6:52 pm

Had a request to enter in dates with a simple MMddYY format.  This is easier than you think.

  1. Create a for and add a Date Picker field to the view
  2. Double-click the field and add a new Rule
  3. Set the Condition as such: 
    1. string-length(.) = 6 and
    2. contains(“/”, .) = false and
    3. contains(“-”,.) = false
  4. Add an Action to Set a Fields Value
    1. Current Field or “.”
    2. Value: concat(substring(today(), 1, 2), substring(., 5, 2), “-”, substring(., 1, 2), “-”, substring(., 3, 2))
  5. Test out the for.  Enter a date like “050109″ and it will put it in as 2009-05-01.

That is it.  Simple and easy to use

June 12, 2009

InfoPath Multi Column Drop Down

Filed under: Uncategorized — Tags: , — kirkhofer @ 2:22 pm

If you need to add a drop-down to an InfoPath form that has a Display Name with multiple columns, you can’t do this out of the box.  In order to make this work, you have to manually edit the XSL behind the scenes.  I don’t believe in adding code behind if you don’t need to but the XSL does not make this form need a Full Trust or anything, so this seems cleaner.

Save your InfoPath form File -> Save As Source Files…  From there go in and edit the view1.xsl or whatever you named your view.  Look for the <option> tags and in there you will find the <xsl:value-of/> tag with the field you chose in the display name.  Now, just add the additional stuff you want, and whala:

<xsl:value-of select="@field1"/>-<xsl:value-of select="@field2"/>

Save the file and open the manifest.xsf in Design mode and take a look

Blog at WordPress.com.