locked
preceding-sibling in browser based form RRS feed

  • Question

  • Hi,

    I have a list and i added two column (state and Action (checkbox data type for Action column).  Now i created data connection and drag and drop this on form as repeating table. I have converted Action field in radio button.

    Now when i browse my form then i am able to select all the radiobutton (as expected). But i want to select only one repeating table row on radio button selection. I have followed this blog http://www.infopathdev.com/blogs/jimmy/archive/2009/08/05/a-mutually-exclusive-radio-button-in-a-repeating-section.aspx .

    It is working fine in client but when i use same process in browser based form then it is not working. i am using infopath 2007.

    Any idea how to implement same. I don't have much experience of preceding-sibling.


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"


    Monday, August 6, 2012 10:57 AM
    Moderator

Answers

All replies

  • Hi,

    This functions preceding-sibling and following-sibling are hard to make working for browser enabled form but it works.

    You can see this post to help you : http://www.infopathdev.com/forums/p/9222/57798.aspx

    But I can suggest you a workaround. You can use conditional formatting to check there is only one checkbox checked. If the condition is not respected, InfoPath will display a red border to tell that there is an error in the form.

    To do this, you can use the "sum" function if your checkbox have values 0 for uncheck and 1 for check.

    So if the sum of the checkbox is greater than one, a validation error border will be display.

    Hope this is clear...


    Visit my blog : http://rmatayron.blogspot.com/

    Monday, August 6, 2012 4:58 PM
  • Hi Remi,

    Thanks for your reply. I have seen this article so far and tried to implement but i was getting unexpected error.

    >You can use conditional formatting to check there is only one checkbox checked.

    I have radio button instead of checkbox so it will not feasible to display red border because in radio button we don't have option to uncheck again (perhaps we can clear the button by rule if selects multiple rows).

    Is there any other expression or rules which can help me to implement such kind of functionality? I have checked below article as well but this is also not working because not able to understand logic of rStarter.

    http://alecpojidaev.wordpress.com/2009/08/26/a-mutually-exclusive-check-box-in-a-repeating-section/


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"

    Tuesday, August 7, 2012 4:34 AM
    Moderator
  • Hi,

    Can we provide data validation / conditional formatting that when i select any radio button then disable others radio button within repeating table using secondary  data source?


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"

    Wednesday, August 8, 2012 5:09 AM
    Moderator
  • Hi,

    Yes this is possible.

    On this very good post of Alec (that you put in the previous post) , there is an example : http://alecpojidaev.wordpress.com/2009/08/26/a-mutually-exclusive-check-box-in-a-repeating-section/

    You can download the example file by clicking on "FILE" in "The file to try" on the second line.

    It will redirect you to the Alec's Skydive with a lot of InfoPath forms developped for multiple case.

    You will have to download the form called "ExclusiveCheckBox". I have tried it, and it works perfectly with checkbox or radio button.

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/

    Wednesday, August 8, 2012 8:12 AM
  • Hi,

    I have this conditional formatting expression now and it is working in client.

    count(current()/preceding-sibling::my:AccessProfileAA/my:rdb_AccessProfileA[. = "true"]) > 0

    or

    count(current()/following-sibling::my:AccessProfileAA/my:rdb_AccessProfileA[. = "true"]) > 0

    Now can you suggest how it can work in browser. (What modification is required here)


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"

    Thursday, August 9, 2012 10:57 AM
    Moderator
  • OK. I have found the solution. preceding-sibling does not work directly in browser form and we have to provide the pull Xpath of our data connection or repeating table.

    In my case i have used the XML connection and bind repeating table programmatically. Now i have used below expression in conditional formatting for checkbox control within repeating table and it works in browser form as well.

    Here is my both expression.

    /my:myFields/my:Approver_section/my:grp_Approvers/my:Approvers/my:rdb_Approver[count(current()/preceding-sibling::my:Approvers/my:rdb_Approver[. = "true"]) > 0]
    OR
    /my:myFields/my:Approver_section/my:grp_Approvers/my:Approvers/my:rdb_Approver[count(current()/following-sibling::my:Approvers/my:rdb_Approver[. = "true"]) > 0]

    Now this expression is useful to select only one checkbox with in a repeating table. Of cource performance is now getting down (this was big issue earlier).

    Hope it could help to other also


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"

    Friday, August 10, 2012 8:05 AM
    Moderator