Hidden Forms

G

Graham

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?
 
T

Thomas 'PointedEars' Lahn

Graham said:
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.

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
 
G

Graham

Snipping below

Thomas 'PointedEars' Lahn said:
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
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 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.
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.



There is no such thing, event-handler attributes are language-independent.
And it is best to write them lowercase.


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.
 
T

Thomas 'PointedEars' Lahn

Graham said:
Snipping below

If only you did.
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'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.
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.
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.
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
 
G

Gregor Kofler

Graham meinte:
Two reasons - 1 - less work for the user - why force him to click on a
submit button when he shoudn't have to?

Huh? And when is the form considered "ready for submission"?
- 2 - reduces the chances him not
completing the process if you simply take him where he he has to go

What? Why the form then - or see above? (On could of course add
change/blur listeners to form elements and submit the latter upon
certain criterias met. "Pain in the ass" would be too generous to
describe such behaviour.)
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

Ah: "It's either our way or the highway." [1]
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.

Add parameters to the URI. Since nobody fills anything in and nobody has
any choice you have to supply relevant parameters in the first place,
know them and can - upon delivery of the page - fill them in easily.
Isn't that what I've done?

Not in the slightest. Sounds "bizarre" at best. Or rather: Looking for a
solution of a non-existent problem.

Gregor


[1]
http://everything2.com/e2node/Our%20way%20or%20the%20highway
 
G

Graham

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

Graham

Thomas 'PointedEars' Lahn said:
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!
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top