Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / September 2007

Tip: Looking for answers? Try searching our database.

Setting Controls' Visibility on form load

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raphael Iloh - 14 Sep 2007 13:02 GMT
Hi all,
I've got a button on an InfoPath form and I'd like the button to be disabled
by default when the form loads, how do I achieve this?

I can set the button's status (enabled/disabled) using the value of another
field on the form but this happens after the form had loaded. What I really
want to achieve is to have the button disabled by default once the form loads.

Best regards,

Raphael Iloh.
SSA - 15 Sep 2007 09:44 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.