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

Hidden Forms

P: n/a
I have long thought there is something missing with HTML forms, in that
there should be a provision for a form with hidden input fields, with the
whole form being hidden, in particular with no submit button that requires
clicking.

I have a form that, when processed by a Perl CGI script, sends back a
'Thankyou' message to the user, and I then want to tell the user that in a
few seconds he will be taken to the next stage of the process, using a
'<meta http-equiv="Refresh" content="5;
url=http://www.mydomain.com/cgi-bin/myscript.pl\">' tag to do it. But I'm
perplexed as to how to incorporate a 'hidden' form into this process, i.e.
one that will have hidden input fields and no submit button. I have been
experimenting by modifying this tag to '<meta http-equiv="Refresh"
content="5; onLoad="myscript.submit();">' with 'onsubmit="return v.exec()"'
added to the form declaration tag, and I have also tried using other
'onChange' , 'onBlur', and other Javascript event-handling attributes in
place of 'onLoad', the aim being to force a 'hidden' form to be submitted
when the page is refreshed. But nothing seems to work.

Any ideas anyone?
Nov 8 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Graham wrote:
I have long thought there is something missing with HTML forms, in that
there should be a provision for a form with hidden input fields, with the
whole form being hidden, in particular with no submit button that
requires clicking.
And what should this be good for?
I have a form that, when processed by a Perl CGI script, sends back a
'Thankyou' message to the user, and I then want to tell the user that in
a few seconds he will be taken to the next stage of the process, using a
'<meta http-equiv="Refresh" content="5;
url=http://www.mydomain.com/cgi-bin/myscript.pl\">' tag to do it.
Don't patronize your users. If they navigate away, it should be because of
their choice. Besides, meta-refreshs don't work always and everywhere.
But I'm perplexed as to how to incorporate a 'hidden' form into this
process, i.e. one that will have hidden input fields and no submit
button.
Again, I don't see the purpose of this.
I have been experimenting by modifying this tag to '<meta
http-equiv="Refresh" content="5; onLoad="myscript.submit();">' with
'onsubmit="return v.exec()"'
One wonders what you think `myscript' and `v' would be in the first place,
and what their submit() and exec() methods would do. That aside, it stands
to reason already that `meta' elements, being non-interactive elements,
don't have event-handler attributes; prose and DTDs of the current HTML
Specification confirm it then.

<http://validator.w3.org/>
added to the form declaration tag, and I have also tried using other
'onChange' , 'onBlur', and other Javascript event-handling attributes in
place of 'onLoad',
There is no such thing, event-handler attributes are language-independent.
And it is best to write them lowercase.
the aim being to force a 'hidden' form to be submitted when the page is
refreshed. But nothing seems to work.
Fantasy coding seldom yields viable results. RTFM.
Any ideas anyone?
State what you want to accomplish and why, not only what you tried to make
it work.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 8 '08 #2

P: n/a
Snipping below

"Thomas 'PointedEars' Lahn" <Po*********@web.dewrote in message
news:49**************@PointedEars.de...
Graham wrote:
>I have long thought there is something missing with HTML forms, in that
there should be a provision for a form with hidden input fields, with the
whole form being hidden, in particular with no submit button that
requires clicking.

And what should this be good for?
Two reasons - 1 - less work for the user - why force him to click on a
submit button when he shoudn't have to? - 2 - reduces the chances him not
completing the process if you simply take him where he he has to go
>
>I have a form that, when processed by a Perl CGI script, sends back a
'Thankyou' message to the user, and I then want to tell the user that in
a few seconds he will be taken to the next stage of the process, using a
'<meta http-equiv="Refresh" content="5;
url=http://www.mydomain.com/cgi-bin/myscript.pl\">' tag to do it.

Don't patronize your users. If they navigate away, it should be because
of
their choice. Besides, meta-refreshs don't work always and everywhere.
I'm not giving them a choice here - there is only one way to go - I just
want to make it easier for them
>
>But I'm perplexed as to how to incorporate a 'hidden' form into this
process, i.e. one that will have hidden input fields and no submit
button.

Again, I don't see the purpose of this.
You may not, but I have often encountered the need to maintain state when a
form is not really relevant. In fact I'd go further and say that it would be
great if there was a way to maintain state when simply hyperlinking from one
page to another.
>
>I have been experimenting by modifying this tag to '<meta
http-equiv="Refresh" content="5; onLoad="myscript.submit();">' with
'onsubmit="return v.exec()"'

One wonders what you think `myscript' and `v' would be in the first place,
and what their submit() and exec() methods would do. That aside, it
stands
to reason already that `meta' elements, being non-interactive elements,
don't have event-handler attributes; prose and DTDs of the current HTML
Specification confirm it then.

<http://validator.w3.org/>
>added to the form declaration tag, and I have also tried using other
'onChange' , 'onBlur', and other Javascript event-handling attributes in
place of 'onLoad',

There is no such thing, event-handler attributes are language-independent.
And it is best to write them lowercase.
>the aim being to force a 'hidden' form to be submitted when the page is
refreshed. But nothing seems to work.

Fantasy coding seldom yields viable results. RTFM.
I would freely admit that, unlike my html and Perl skills, my Javascript
skills are very weak. That's why I am seeking advice.
>
>Any ideas anyone?

State what you want to accomplish and why, not only what you tried to make
it work.
Isn't that what I've done?
>

PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann

Nov 8 '08 #3

P: n/a
Graham wrote:
Snipping below
If only you did.
"Thomas 'PointedEars' Lahn" wrote [...]:
>Graham wrote:
>>I have long thought there is something missing with HTML forms, in
that there should be a provision for a form with hidden input fields,
with the whole form being hidden, in particular with no submit button
that requires clicking.
And what should this be good for?
Two reasons - 1 - less work for the user - why force him to click on a
submit button when he shoudn't have to? - 2 - reduces the chances him not
completing the process if you simply take him where he he has to go
I am not buying it. Chances are that you want to submit data without the
user knowing about it, which is a Bad Thing.
>>I have a form that, when processed by a Perl CGI script, sends back a
'Thankyou' message to the user, and I then want to tell the user
that in a few seconds he will be taken to the next stage of the
process, using a '<meta http-equiv="Refresh" content="5;
url=http://www.mydomain.com/cgi-bin/myscript.pl\">' tag to do it.
Don't patronize your users. If they navigate away, it should be
because of their choice. Besides, meta-refreshs don't work always and
everywhere.

I'm not giving them a choice here - there is only one way to go - I just
want to make it easier for them
Again, I'm not buying it. The "Thank you" can and should be placed in the
document that you don't need to redirect to anymore then.
>>But I'm perplexed as to how to incorporate a 'hidden' form into this
process, i.e. one that will have hidden input fields and no submit
button.
Again, I don't see the purpose of this.
You may not, but I have often encountered the need to maintain state when
a form is not really relevant.
Don't use a form then.
In fact I'd go further and say that it would be great if there was a way
to maintain state when simply hyperlinking from one page to another.
That wheel has been invented already and is called a session, which can be
maintained both client-side and server-side. You don't need the workaround
of hidden forms for it.
>>the aim being to force a 'hidden' form to be submitted when the page
is refreshed. But nothing seems to work.
Fantasy coding seldom yields viable results. RTFM.
I would freely admit that, unlike my html and Perl skills, my Javascript
skills are very weak. That's why I am seeking advice.
That's why you should RTFM first because without basic knowledge you are
unlikely to understand the answers here and only waste everybody's (free-)time.
>>Any ideas anyone?
State what you want to accomplish and why, not only what you tried to
make it work.
Isn't that what I've done?
Yes, it was not. You also have to learn how to quote properly.

<http://jibbering.com/faq/>
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Nov 8 '08 #4

P: n/a
Well it looks like I need to mug up on 'sessions' (although it was hard work
getting there). Many thanks anyway!

"Thomas 'PointedEars' Lahn" <Po*********@web.dewrote in message
news:49**************@PointedEars.de...
Graham wrote:
>Snipping below

If only you did.
>"Thomas 'PointedEars' Lahn" wrote [...]:
>>Graham wrote:
I have long thought there is something missing with HTML forms, in
that there should be a provision for a form with hidden input fields,
with the whole form being hidden, in particular with no submit button
that requires clicking.
And what should this be good for?
Two reasons - 1 - less work for the user - why force him to click on a
submit button when he shoudn't have to? - 2 - reduces the chances him not
completing the process if you simply take him where he he has to go

I am not buying it. Chances are that you want to submit data without the
user knowing about it, which is a Bad Thing.
>>>I have a form that, when processed by a Perl CGI script, sends back a
'Thankyou' message to the user, and I then want to tell the user
that in a few seconds he will be taken to the next stage of the
process, using a '<meta http-equiv="Refresh" content="5;
url=http://www.mydomain.com/cgi-bin/myscript.pl\">' tag to do it.
Don't patronize your users. If they navigate away, it should be
because of their choice. Besides, meta-refreshs don't work always and
everywhere.

I'm not giving them a choice here - there is only one way to go - I just
want to make it easier for them

Again, I'm not buying it. The "Thank you" can and should be placed in the
document that you don't need to redirect to anymore then.
>>>But I'm perplexed as to how to incorporate a 'hidden' form into this
process, i.e. one that will have hidden input fields and no submit
button.
Again, I don't see the purpose of this.
You may not, but I have often encountered the need to maintain state when
a form is not really relevant.

Don't use a form then.
>In fact I'd go further and say that it would be great if there was a way
to maintain state when simply hyperlinking from one page to another.

That wheel has been invented already and is called a session, which can be
maintained both client-side and server-side. You don't need the
workaround
of hidden forms for it.
>>>the aim being to force a 'hidden' form to be submitted when the page
is refreshed. But nothing seems to work.
Fantasy coding seldom yields viable results. RTFM.
I would freely admit that, unlike my html and Perl skills, my Javascript
skills are very weak. That's why I am seeking advice.

That's why you should RTFM first because without basic knowledge you are
unlikely to understand the answers here and only waste everybody's
(free-)time.
>>>Any ideas anyone?
State what you want to accomplish and why, not only what you tried to
make it work.
Isn't that what I've done?

Yes, it was not. You also have to learn how to quote properly.

<http://jibbering.com/faq/>
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16

Nov 8 '08 #5

P: n/a
Graham wrote:
Well it looks like I need to mug up on 'sessions' (although it was hard
work getting there).
Good advice is seldom cheap.
Many thanks anyway!
You are welcome.
[Top post]
Please don't.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Nov 8 '08 #6

P: n/a

"Thomas 'PointedEars' Lahn" <Po*********@web.dewrote in message
news:49**************@PointedEars.de...
Graham wrote:
>Well it looks like I need to mug up on 'sessions' (although it was hard
work getting there).

Good advice is seldom cheap.
Agreed. I have now passed what I wanted to pass (an ID number) as part of a
query string. I add a 4 digit random number in front of the ID number, and a
3 digit randon number at the end of it, encode it before passing, then
decode and strip out the 7 digits within the scriipt I am passing to. Not
quite a session I know, but another skill mastered!
>
>Many thanks anyway!
And again!
>
You are welcome.
>[Top post]

Please don't.
I hope I am now posting to your satisfaction

Graham
(if you want a job done, give it too a busy man)
>

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>

Nov 10 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.