Submitting checkboxes to list and back out again - InfoPath Dev
in

InfoPath Dev

Submitting checkboxes to list and back out again

Last post 10-05-2010 10:08 AM by gabe w. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-11-2010 10:25 AM

    • selch
    • Not Ranked
    • Joined on 09-17-2009
    • Posts 18

    Submitting checkboxes to list and back out again

    I'm using qRules to submit a form to a list. The form has checkboxes on it with values of True and False. Everything submits just fine. The problem I have is that I'm making another form that pulls a repeating table of that list data. The text fields all populate fine for each row however the checkboxes that should be checked aren't. I see in my list that SharePoint has changed the values from True and False to Yes and No but I can't seem to figure out a rule that would evaluate this and then check the box in my repeating table.

     

    Ideas? Thanks much!

  • 02-12-2010 12:57 AM In reply to

    Re: Submitting checkboxes to list and back out again

     The problem here is a disconnect between the SharePoint list's return values and InfoPath's functionality.  The values it actually sends down for a checkbox list item are 1 for True/Yes and 0 for False/No, but InfoPath's default behavior for checkboxes is to show them as checked when the value is "true", and unchecked otherwise, and to make matters worse, you can't modify a checkbox's properties when it's bound to a secondary data source.

     The solution is to modify the XSL file that generates the view.  Save your form as its source files, and open up the XSL file that represents your view.  Search for the name of the field in question and you should find the XSL that corresponds to your checkbox:

    <input class="xdBehavior_Boolean" title="" type="checkbox" xd:CtrlId="CTRL4" xd:xctname="CheckBox" tabIndex="0" xd:binding="@YesNoColumn" xd:boundProp="xd:value" xd:offValue="false" xd:onValue="true">
          <xsl:attribute name="xd:value">
                <xsl:value-of select="@YesNoColumn"/>
          </xsl:attribute>
          <xsl:if test="@YesNoColumn=&quot;true&quot;">
                <xsl:attribute name="CHECKED">CHECKED</xsl:attribute>
          </xsl:if>
     </input> Yes No Column

     Note the bold underlined parts above.  Try changing the false to 0 and the two trues to 1.  Then save the file.  Right-click manifest.xsf and select Design to reopen the form and try it again.  Note that even after doing this, the checkboxes will behave strangely, so you might want to disable them.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-12-2010 07:06 AM In reply to

    • selch
    • Not Ranked
    • Joined on 09-17-2009
    • Posts 18

    Re: Submitting checkboxes to list and back out again

     Man, you guys are good. Thank you! Works like a charm!

  • 02-12-2010 08:31 AM In reply to

    Re: Submitting checkboxes to list and back out again

    You can do this in the designer (without manually editing the XSL) by getting into the Check Box Properties dialog box. This will work only if your check box is bound to a Main DOM node. For secondary data sources, you can use the XSL edit technique.

  • 10-05-2010 10:08 AM In reply to

    • gabe w
    • Not Ranked
    • Joined on 10-05-2010
    • Posts 1

    Re: Submitting checkboxes to list and back out again

    Hi -

    Thanks for your post.  Could you elaborate on how to bind a secondary data source field to a main data field?  Is this possible to do?  If not, is there a preferred approach?

    Thanks

    Gabe
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.