locked
Infopath 2007 default textbox = boolean('false') and boolean('false') = 'true'? RRS feed

  • Question

  • I did a simple test using a textbox with the default value being:

    •  boolean('false') and boolean('false')

    and it returns true?!? how bizzare is that?

     

    Infact, I am consolidating 2 checkboxes to return a result back to SharePoint.

    Have I set something wrong?

    Thanks

     

     

    • Edited by Mike Walsh FIN Monday, June 14, 2010 6:11 PM NEVER write more than one question mark in your Titles. This would have been deleted (4x?) if people hadn't already spent time replying to you
    Sunday, June 13, 2010 6:27 PM

Answers

  • You have to double check default values for your checkboxes controls (not fields default values). They have to be true for checked state and false for unchecked.


    http://alecpojidaev.wordpress.com
    • Marked as answer by Seven M Saturday, June 26, 2010 3:57 AM
    Monday, June 14, 2010 10:06 PM

All replies

  • I don't understand your formula.  What does boolean('false') and boolean('false') mean?  What are you trying to do with the "and" in the middle.  What is your expected result?

    The boolean XPath function is intended for determining if a field or group exists.  You didn't specify a field or group and just put the text 'false'?  What is that supposed to do in your scenario?  The result of boolean('false') is True.  Actually, the result of any text in that space is True.  It is supposed to be a field, not text.  If you specified your checkboxes, the result will still be True.  If you want to consolidate the actual results of the checkboxes, then don't use the boolean function.  Just let me know what the exact result is that you're wanting to achieve.


    SharePoint Architect || Microsoft MVP || My Blog

    • Proposed as answer by Scott Lock Sunday, May 15, 2011 5:07 AM
    Sunday, June 13, 2010 6:51 PM
  • Hi Clayton,

    Many thanks for your reply.  I had a look at the 'comment' in infopath for the function 'Boolean' it says 'Converts the argument to a Boolean'.  This i suppose, naively, assumed means 1=true, 0=false, 'true'=true, 'false'=false.

    Consider the form, with fields

    [ ] Checkbox1
    [ ] Checkbox2
    ___________ Textbox1

     

    Scenario1, Neither checkbox1 or 2 is checked.  Textbox1 = 'false'
    Scenario2, Either checkbox1 or 2 are checked. Textbox1='false'
    Scenario3, Both checkbox1 and 2 are checked.  Textbox1 = 'true'

    Hence, Textbox1 has a default value = '/my:checkbox1 and /my:checkbox2'.  This however, is always true.

    Or i tried, default value='boolean(/my:checkbox1) and boolean(/my:checkbox2)', but this is always true.

     

    I'm sure that i've set something incorrectly, but cannot see where or why.

     

    Many thanks

    William Man

    Monday, June 14, 2010 10:49 AM
  • Looks like i need to set it like this,

    (/my:checkbox1='true') and (/my:checkbox2='true')

     

    Monday, June 14, 2010 12:51 PM
  • First of all you don't need function boolean(). If default values for checkboxes are false or true (no quotes) than

    if you place that formula in expression box it will work:

    /my:checkbox1 and /my:checkbox2


    http://alecpojidaev.wordpress.com
    Monday, June 14, 2010 2:18 PM
  • Only problem is your above expression returns 'true' with both checkbox unchecked, or always true.

     

    Monday, June 14, 2010 5:07 PM
  • You have to double check default values for your checkboxes controls (not fields default values). They have to be true for checked state and false for unchecked.


    http://alecpojidaev.wordpress.com
    • Marked as answer by Seven M Saturday, June 26, 2010 3:57 AM
    Monday, June 14, 2010 10:06 PM