By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,817 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,817 IT Pros & Developers. It's quick & easy.

how to blank the screen when any submit-type buttons clicked

P: n/a
Is there a way to blank the screen in a FORM's onsubmit=... to blank
the screen for the user??

I asked this before and got a way to blank a table by id with

"document.getElementById('tabid').style.display='n one';" in the onclick
event and setting the encapsulating table's ID to 'tabid'.

I was wondering if this or some other similar approach that could
possibly be planted globally in my pages in the onsubmit validation
sequence ????

Oct 3 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a

"charlie_M" <cm******@comcast.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Is there a way to blank the screen in a FORM's onsubmit=... to blank
the screen for the user??

I asked this before and got a way to blank a table by id with

"document.getElementById('tabid').style.display='n one';" in the onclick
event and setting the encapsulating table's ID to 'tabid'.


you could put your "page" content in a div and then just hide the whole
div.
Oct 3 '05 #2

P: n/a
Can you nest DIVs??

The problem and the reason I ask the original question... these pages
are written in Foxpro and there are literally hundreds of them. I am
loking for the easiest method to blank the screen when sublitted and
would favor the method that would allow trhe change be centrally
applied (like a form's onsubmit()).

TIA
Chuck

Oct 3 '05 #3

P: n/a
charlie_M said the following on 10/3/2005 3:45 PM:
Can you nest DIVs??
Yes. What does that have to do with Javascript?
The problem and the reason I ask the original question... these pages
are written in Foxpro and there are literally hundreds of them. I am
loking for the easiest method to blank the screen when sublitted and
would favor the method that would allow trhe change be centrally
applied (like a form's onsubmit()).


If Foxpro is screwing your pages up that bad, you need a new editor.

<form onsubmit="hideTheBody()">

function hideTheBody(){
bodyNode = document.body?document.body:document.documentEleme nt;
bodyNode.innerHTML = '';
}

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Oct 3 '05 #4

P: n/a
Does this allow the form to be submitted?? My initial test shows the
screen blanks.. but the data does not go to the server??
FYI:. Foxpro is not an editor.... also not javascript ;o)) Foxpro is a
fuly compiled language with similarities to Visual Basic and C++ and
the ilk. In this case... Foxpro is generating/interpreting web pages
and serving them through an isapi interface to/from a webserver.

Oct 4 '05 #5

P: n/a
Randy Webb wrote:
charlie_M said the following on 10/3/2005 3:45 PM:
Can you nest DIVs??

Yes. What does that have to do with Javascript?
The problem and the reason I ask the original question... these pages
are written in Foxpro and there are literally hundreds of them. I am
loking for the easiest method to blank the screen when sublitted and
would favor the method that would allow trhe change be centrally
applied (like a form's onsubmit()).

If Foxpro is screwing your pages up that bad, you need a new editor.

<form onsubmit="hideTheBody()">

function hideTheBody(){
bodyNode = document.body?document.body:document.documentEleme nt;
bodyNode.innerHTML = '';
}


That doesn't work, by the time the submit runs, there is nothing left to
submit (or was that the intention?).

Try:

function hideTheBody()
{
bodyNode = document.body? document.body : document.documentElement;
if (bodyNode.style){
bodyNode.style.display = 'none';
}
}

However, it seems like a very bad idea - why not just write 'The form is
being submitted' or similar to the page in a faux message dialog?.

--
Rob
Oct 4 '05 #6

P: n/a
charlie_M wrote:
Is there a way to blank the screen in a FORM's onsubmit=... to blank
the screen for the user??

I asked this before and got a way to blank a table by id with

"document.getElementById('tabid').style.display='n one';" in the onclick
event and setting the encapsulating table's ID to 'tabid'.

I was wondering if this or some other similar approach that could
possibly be planted globally in my pages in the onsubmit validation
sequence ????


If you have some sort of global onsubmit function , you most certainly
could blank the screen or just about anything else.

I would broabably not choose display:none , as it confuses some browsers
as relates to the content of the container becomming not only invisible,
but occasionally inacessible to script. perhaps if you simply take the
div with the form in it and adjust the left or top to a location that is
-x and/or -y enough to be off screen.
--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> Internet Programming since 1994 <>=-- DHTML NSAPI TCP/IP
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Oct 4 '05 #7

P: n/a
Dr Clue wrote:
charlie_M wrote:
Is there a way to blank the screen in a FORM's onsubmit=... to blank
the screen for the user??

I asked this before and got a way to blank a table by id with

"document.getElementById('tabid').style.display='n one';" in the onclick
event and setting the encapsulating table's ID to 'tabid'.

I was wondering if this or some other similar approach that could
possibly be planted globally in my pages in the onsubmit validation
sequence ????

If you have some sort of global onsubmit function , you most certainly
could blank the screen or just about anything else.

I would broabably not choose display:none , as it confuses some browsers
as relates to the content of the container becomming not only invisible,
but occasionally inacessible to script. perhaps if you simply take the
div with the form in it and adjust the left or top to a location that is
-x and/or -y enough to be off screen.


The following hides just the form, but it could hide the entire body.

There are some usability issues here - what happens if the submit fails?
The user now has a blank page and must work out that they need to
refresh the page rather than navigate 'back' - how is that really any
different to learning that they should only submit once and wait?

If the submit takes a while and the page stays blank, will they hang
around or just go elsewhere and possibly screw-up whatever process they
were engaged in?

Why attempt to teach non-standard behaviour?

Anyhow:

<form ... onsubmit="hideMe(this);">

// Using a shift:
function hideMe(f)
{
f.style.position = 'absolute';
f.style.left = '-9000px';
}
// Using visibility:
function hideMe(f)
{
f.style.visibility = 'hidden';
}

--
Rob
Oct 4 '05 #8

P: n/a
RobG said the following on 10/3/2005 9:19 PM:
Randy Webb wrote:
charlie_M said the following on 10/3/2005 3:45 PM:
Can you nest DIVs??
Yes. What does that have to do with Javascript?
The problem and the reason I ask the original question... these pages
are written in Foxpro and there are literally hundreds of them. I am
loking for the easiest method to blank the screen when sublitted and
would favor the method that would allow trhe change be centrally
applied (like a form's onsubmit()).


If Foxpro is screwing your pages up that bad, you need a new editor.

<form onsubmit="hideTheBody()">

function hideTheBody(){
bodyNode = document.body?document.body:document.documentEleme nt;
bodyNode.innerHTML = '';
}

That doesn't work, by the time the submit runs, there is nothing left to
submit (or was that the intention?).


<g>

I get facetious at times :)
Try:

function hideTheBody()
{
bodyNode = document.body? document.body : document.documentElement;
if (bodyNode.style){
bodyNode.style.display = 'none';
}
}

However, it seems like a very bad idea - why not just write 'The form is
being submitted' or similar to the page in a faux message dialog?.


My personal preference is to let the user screw up. Nothing will teach
you quicker not to double-submit a form than trying to go through email
tech (or the phone) to try to get your money back after making that
screw up.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Oct 4 '05 #9

P: n/a
Randy Webb wrote:
RobG said the following on 10/3/2005 9:19 PM:
Randy Webb wrote:
[...]

If Foxpro is screwing your pages up that bad, you need a new editor.

<form onsubmit="hideTheBody()">

function hideTheBody(){
bodyNode = document.body?document.body:document.documentEleme nt;
bodyNode.innerHTML = '';
}


That doesn't work, by the time the submit runs, there is nothing left
to submit (or was that the intention?).

<g>

I get facetious at times :)


The 'Foxpro as an editor' bit was something of a giveaway! ;-)

[...]
However, it seems like a very bad idea - why not just write 'The form
is being submitted' or similar to the page in a faux message dialog?.

My personal preference is to let the user screw up. Nothing will teach
you quicker not to double-submit a form than trying to go through email
tech (or the phone) to try to get your money back after making that
screw up.


Yes. I thought issues with multiple submits were fixed years ago on the
server. Client-side scripting is bound to fail sufficiently often that
it can only be considered a convenience some of the time for some users
and certainly not a robust solution.

I get the feeling a course somewhere has a unit on multiple submission
and some of the students have decided to come here...
--
Rob
Oct 4 '05 #10

P: n/a

RobG wrote:
Try:

function hideTheBody()
{
bodyNode = document.body? document.body : document.documentElement;
if (bodyNode.style){
bodyNode.style.display = 'none';
}
}

OK.. this solution works for submit buttons. However... it does not
appear to hit the <form onsubmit"....> when the page is submitted by
some of the form's other elements... like 'onclick="submit()"' and
'onchange="submit()"'. Whats up with that??

As for the suggested solution "put up a faux message..." that might
work too. Can it be placed in the center of a screen and will it go
away when the new screen arrives without intervention??
Chas

Oct 4 '05 #11

P: n/a
charlie_M said the following on 10/4/2005 10:39 AM:
RobG wrote:

Try:

function hideTheBody()
{
bodyNode = document.body? document.body : document.documentElement;
if (bodyNode.style){
bodyNode.style.display = 'none';
}
}

OK.. this solution works for submit buttons. However... it does not
appear to hit the <form onsubmit"....> when the page is submitted by
some of the form's other elements... like 'onclick="submit()"' and
'onchange="submit()"'. Whats up with that??


What is up with that is that you are using the incorrect elements to
cause form submission.

formName.submit() does not fire the onsubmit event handler.
As for the suggested solution "put up a faux message..." that might
work too. Can it be placed in the center of a screen and will it go
away when the new screen arrives without intervention??


Try it and see.......

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 4 '05 #12

P: n/a

Randy Webb wrote:
What is up with that is that you are using the incorrect elements to
cause form submission.

formName.submit() does not fire the onsubmit event handler.


That one fact is very disapointing. I feel I am not using 'incorrect'
elements but I am let down with the fact that they don't fire through
the form''s onsubmit. I wonder what the thinking was??? Why not?

I did put this solution in a global onsubmit handler.... but now I
guess I need to add the call to 'hideTheBox()' in each and every
'onclick=' and 'onchange=' phrase in-use on the application website....
Oh well ;o))

My thanks to everyone who tried to help me with this.

Chas

Oct 4 '05 #13

P: n/a
charlie_M said the following on 10/4/2005 3:02 PM:
Randy Webb wrote:
What is up with that is that you are using the incorrect elements to
cause form submission.

formName.submit() does not fire the onsubmit event handler.
That one fact is very disapointing. I feel I am not using 'incorrect'
elements but I am let down with the fact that they don't fire through
the form''s onsubmit. I wonder what the thinking was??? Why not?


The only element in HTML whose purpose is to submit a form is an <input
type="submit">. Anything else that is used to submit or cause a form to
be submitted is incorrect use of the element. Form elements have
intended uses and to use them for anything else is incorrect usage.
I did put this solution in a global onsubmit handler.... but now I
guess I need to add the call to 'hideTheBox()' in each and every
'onclick=' and 'onchange=' phrase in-use on the application website....
Oh well ;o))


How does your form get submitted if JS is disabled? And, if your users
are too lazy to click a Submit button, how would they ever conjure up
the energy to click it twice?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 4 '05 #14

P: n/a

Randy Webb wrote:
The only element in HTML whose purpose is to submit a form is an <input
type="submit">. Anything else that is used to submit or cause a form to
be submitted is incorrect use of the element. Form elements have
intended uses and to use them for anything else is incorrect usage.
Thanks for clearing that up... but I would have hoped that js's
submit() would have tried to emulate this behavior?!?
How does your form get submitted if JS is disabled? And, if your users
are too lazy to click a Submit button, how would they ever conjure up
the energy to click it twice?

This is a monsterous application for clients. We (IT) get to specify
browser(s) and feature(s) in order to serve their purposes. JS=true is
just one of the specs.

As for the lazy users.. typically they double-click an element and the
way the system accesses the massive files it deals with .... it takes
sometimes 2-3 seconds to respond to a query... and the system races to
catch the subsequent clicks and bypass them. A great many of the pages
do not even have a submit button......... action taking place onclick
and onchange.

Chas

Oct 5 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.