Create a hidden field in your form and add a rule, e.g, if the hidden field
is blank then hide another control else display it. The hidden field will
always be blank by default so your control will be disabled when the form
loads. You can also do this programmatically:
public void InternalStartup()
{
EventManager.FormEvents.Loading += new
LoadingEventHandler(FormEvents_Loading);
}
private void FormEvents_Loading(object sender, LoadingEventArgs e)
{
XPathNavigator _DOM = this.MainDataSource.CreateNavigator();
XPathNavigator Option =
_DOM.SelectSingleNode("/my:myFields/my:yourfieldname", this.NamespaceManager);
Option.SetValue("anyvalue");
}
This code will set the hidden field's value which will enable the button
according to the rule that you applied in your form. Similarly, you can clear
the field to disable the button.
Hope this helps
http://sharepointblogs.com/ssa
> Hi all,
> I've got a button on an InfoPath form and I'd like the button to be disabled
[quoted text clipped - 7 lines]
>
> Raphael Iloh.
Raphael Iloh - 17 Sep 2007 10:12 GMT
Hi SSA,
Unfortuantely your response does not answer my question; I can create a new
field alright (either via InfoPath UI or programmatically) but that does not
give me any form of handle/access to the button. Again, setting rules on a
field to control the availability (or otherwise) of a button control doesn't
appear possible as the button isn't listed as a filed item.
My question again is: how do I disable a button by default once an InfoPath
form loads? It needs to be disabled prior to the very first user-action; This
probably could be done in the onload event of the form but how do I get a
handle/access to the BUTTON (or its properties) from the codes?
Best regards,
Raphael.
> Create a hidden field in your form and add a rule, e.g, if the hidden field
> is blank then hide another control else display it. The hidden field will
[quoted text clipped - 36 lines]
> >
> > Raphael Iloh.
K.Ramana Reddy(GGK Tech) - 18 Sep 2007 11:10 GMT
Hi,
You want disable the form when the form first time opened?

Signature
k.Ramana Reddy
http://www.GGKtech.com
> Hi SSA,
> Unfortuantely your response does not answer my question; I can create a new
[quoted text clipped - 52 lines]
> > >
> > > Raphael Iloh.