A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Tuesday, October 16, 2007

InfoPath button with simple rule attached doesn't work!

I had a button in my form and there was a simple rule attached to this button. Rule was that If someone clicked the button, a (hidden) textbox would appear in the form, a very simple rule! Problem?? The button was not working. Somehow the event was not firing. I had this problem even before but simply changing the ID of the button resolved my problem but this time, changing the ID didn't work. I spent a couple of hours trying to find the cause but in the end, I needed a quick solution as I was short of time (as usual). The problem was resolved when I added an empty event handler for the button in the form.
 ((ButtonEvent)EventManager.ControlEvents["Button"]).Clicked += new ClickedEventHandler(Button_Clicked);
  public void Button_Clicked(object sender, ClickedEventArgs e)
        {
            // Write your code here.
        }
Now, I don't understand why some buttons work without an event handler and the others don't. I added two buttons to the form, one is firing the other is not! Why? I don't have time to find the cause at the moment, will spend some time on this on the weekend.

No comments:

Post a Comment