Infopath disable selected checkboxes on button click - InfoPath Dev
in

InfoPath Dev

Infopath disable selected checkboxes on button click

Last post 01-23-2014 07:30 PM by Mo Alshorbaji. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-21-2014 02:22 AM

    Infopath disable selected checkboxes on button click

    Hi, I have a checkbox area with a button. When I click the button I want the checkboxes that where selected to be desactivated in the click method.

    I have a foreach to verify every checkbox but I dont know how to disable then. Any help pls?

            public void btnValiderChoixFormulaire_Clicked(object sender, ClickedEventArgs e)
            {
                //Variables
                XPathNavigator formNavigator = this.MainDataSource.CreateNavigator();
                XPathNavigator TypeQUESTION = formNavigator.SelectSingleNode("//my:txtTypeQuestion", NamespaceManager);
                XPathNavigator chkType_Cat = null;
                string strTypeQUESTION = "|";
                Categorie InstanceCategorie = new Categorie();
    
                List<Categorie> catList = InstanceCategorie.GetListCategorie();
                foreach (Categorie cat in catList)
                {
                    chkType_Cat = formNavigator.SelectSingleNode("//my:chkType_" + cat.IDCategorie, NamespaceManager);
                    if (chkType_Cat.Value == "1")
                    {
                        >>>>>>>>>>>> disable the checkbox <<<<<<<<<<<<
                     }
    
                }
                //Affectation du type
                TypeQUESTION.SetValue(strTypeQUESTION);
            }

    thanks

  • 01-23-2014 07:30 PM In reply to

    Re: Infopath disable selected checkboxes on button click

     Hi Renatois,

    What you can do is add a new field and set it as a trigger when the button is clicked so that the checkboxes know when to run a formatting rule. So add a new field and name it Trigger for example. Now add an action rule on your button > Set a field value > Field: Trigger > Value: 1. Next you add a formatting rule on your checkbox(s) Condition: Trigger is equal to "1" AND  field1(or in your case select the name of your checkbox field) is equal to TRUE. This way the condition is that trigger = 1 meaning the button has to be clicked and field1 = TRUE meaning the checkbox has to be checked. Finally check the Disable this control checkbox in the bottom of the formatting rule panel. All you have to do is repeat these rules for the rest of your checkboxes and once you click the button all checkboxes that are checked will be disabled.

    Hope that helps,

    Mo 

    Mohammad Alshorbaji
    Qdabra® Software / InfoPathDev.com / 877.544.2389
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.