Hi,
How can you hide controls, e.g. labels, text boxes etc, when a form is
loaded.
I've written the function below
function HideControls()
{
document.ApplicationForm.txtFrom.style.visibility='hidden';
document.ApplicationForm.txtTo.style.visibility='hidden';
}
and call this function within the <form onload="HideControls()"; ...> tag.
But it doesn't seem to work as expected.
Can somebody help?
Thanks

--

Re: Hide controls when form loads by Kevin

Kevin
Fri Oct 14 04:13:20 CDT 2005

Try not putting the code into a function, but at the bottom of the form,
just before the </form> tag. The form element doesn't have an "onload"
event. Often, putting such an event handler in the body "onload" event
doesn't work, due to the fact that an HTML document is often loaded in
"chunks" from the server. But any JavaScript code that is not inside a
function is executed immediately upon the loading of the page.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"RudiH" <pgl@ihug.co.nz> wrote in message
news:4EC879B7-922B-42D8-B054-B5036919FF57@microsoft.com...
> Hi,
> How can you hide controls, e.g. labels, text boxes etc, when a form is
> loaded.
> I've written the function below
> function HideControls()
> {
> document.ApplicationForm.txtFrom.style.visibility='hidden';
> document.ApplicationForm.txtTo.style.visibility='hidden';
> }
> and call this function within the <form onload="HideControls()"; ...> tag.
> But it doesn't seem to work as expected.
> Can somebody help?
> Thanks
>
> --
>



Re: Hide controls when form loads by Stefan

Stefan
Fri Oct 14 04:33:52 CDT 2005

Or scrap the script (if you are not going to make them visible w/ another script call) and just add the fields as std hidden form
fields
<input type="hidden" name="txtFrom" value="xxxxx">

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message news:OCJuG%23J0FHA.3000@TK2MSFTNGP12.phx.gbl...
| Try not putting the code into a function, but at the bottom of the form,
| just before the </form> tag. The form element doesn't have an "onload"
| event. Often, putting such an event handler in the body "onload" event
| doesn't work, due to the fact that an HTML document is often loaded in
| "chunks" from the server. But any JavaScript code that is not inside a
| function is executed immediately upon the loading of the page.
|
| --
| HTH,
|
| Kevin Spencer
| Microsoft MVP
| .Net Developer
| Ambiguity has a certain quality to it.
|
| "RudiH" <pgl@ihug.co.nz> wrote in message
| news:4EC879B7-922B-42D8-B054-B5036919FF57@microsoft.com...
| > Hi,
| > How can you hide controls, e.g. labels, text boxes etc, when a form is
| > loaded.
| > I've written the function below
| > function HideControls()
| > {
| > document.ApplicationForm.txtFrom.style.visibility='hidden';
| > document.ApplicationForm.txtTo.style.visibility='hidden';
| > }
| > and call this function within the <form onload="HideControls()"; ...> tag.
| > But it doesn't seem to work as expected.
| > Can somebody help?
| > Thanks
| >
| > --
| >
|
|