Javascript to include field on next form

I

irkland

Bear with me because I don't even know how to ask this, but...

I've got a short form--1 field and a submit button. I want someone to
enter their name in that field, hit submit, and have their name be in
the "name" field on the next page (which contains a form). Am I even
in the right forum?

Thanks so much for your help.

Jay
 
T

Thomas 'PointedEars' Lahn

I've got a short form--1 field and a submit button. I want someone to
enter their name in that field, hit submit, and have their name be in
the "name" field on the next page (which contains a form). Am I even
in the right forum?

For you to be in the right or wrong (Web) forum would require this _public
Usenet newsgroup_ to be a (Web) forum instead. (You are using but a Google
mirror/archive of it.)

However, whether or not your question is off-topic here depends on how you
want to generate the "next page": using client-side J(ava)Script/ECMAScript
for this would be unwise, as that would not degrade gracefully; using
server-side J(ava)Script would be possible.


PointedEars
 
C

Cov

For you to be in the right or wrong (Web) forum would require this _public
Usenet newsgroup_ to be a (Web) forum instead. (You are using but a Google
mirror/archive of it.)

However, whether or not your question is off-topic here depends on how you
want to generate the "next page": using client-side J(ava)Script/ECMAScript
for this would be unwise, as that would not degrade gracefully; using
server-side J(ava)Script would be possible.

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, <[email protected]>

I think you have 3 options.

The first would be to use the URL to include the name you want put in
the form:
www.myurl.com/mysecondpage.html?John%20Smith

On the second page you could access the URL via document.referrer

Another option would be to use frames and access variables from the
parent frame with: parent.inputName

And Lastly, you could open the second form with a window with
window.open(). Again the parent variables are accessed through
parent.whatever-the-variable-name.

These are off the top of my head from when I used to code in
Javascript years ago. The information might be outdated and/or
inaccurate. Sorry.
 
D

David Mark

Are you responding to PointedEars? He didn't ask the question.
I think you have 3 options.

The first would be to use the URL to include the name you want put in
the form:www.myurl.com/mysecondpage.html?John%20Smith

On the second page you could access the URL via document.referrer

That doesn't make any sense. Perhaps you meant
window.location.search?
Another option would be to use frames and access variables from the
parent frame with: parent.inputName

I don't know what that means, but frames are ill-advised in general
and have nothing to do with the OP's question.
And Lastly, you could open the second form with a window with
window.open(). Again the parent variables are accessed through
parent.whatever-the-variable-name.

You are confused. See the FAQ entry about submitting a form to a new
window. Regardless, like frames, new windows have nothing to do with
the question.
These are off the top of my head from when I used to code in
Javascript years ago. The information might be outdated and/or
inaccurate. Sorry.

Inaccurate for sure. It can't be outdated as it was never accurate.
It is nice that you apologized in advance, but it would have been
better to skip posting this entirely.
 
C

Cov

Are you responding to PointedEars? He didn't ask the question.
Well, not really. I am responding to the person who DID ask the
question.
Okay, I should have navigated back up to the original poster, but I
would have thought that it was pretty obvious to all but the most
pedantic pedant. :)
That doesn't make any sense. Perhaps you meant
window.location.search?
You are correct.
According to O'Rielly's Definitive Guide to Javascript (3rd Edition),
document.referrer refers to the document which linked the current
document. What I meant to say was document.location, however, I see
this is deprecated so document.URL, should be used instead. Or, as you
suggest, window.location.
I don't know what that means, but frames are ill-advised in general
and have nothing to do with the OP's question.
I don't see why. I often used to use zero width frames as a way of
keeping track of variables on a site without using cookies (an option
that the OP might also like to consider).
The OP wanted a technigue to place the results of an input from one
form into another form on a different page. If the variable is defined
in the Master frame it can be changed to the value retrieved from the
first form and can be accessed by the second page to populate an input
field on that second form.
You are confused. See the FAQ entry about submitting a form to a new
window. Regardless, like frames, new windows have nothing to do with
the question.
No, I am lucid. However, you are probably right in this case. Opening
new windows in today's climate of paranoia and pop-up blockers is very
likely ill-advised.
However, it DOES work, and in much the same way as the frames
technique works.
Inaccurate for sure. It can't be outdated as it was never accurate.
Well, maybe....
It is nice that you apologized in advance, but it would have been
better to skip posting this entirely.
Yes, you have forced me to realise that I was very unwise to post at
all on this forum.

Rest assured that I won't be back! :)
 
T

Thomas 'PointedEars' Lahn

Cov said:
[...]
These are off the top of my head from when I used to code in
Javascript years ago. The information might be outdated and/or
inaccurate. Sorry.

I just don't get it. Why don't you just *refrain from posting* if you are
not even sure that the information you provide is up-to-date or accurate?
Nothing can be gained by people like you making noise here with their
smattering, if that.


PointedEars
 
D

David Mark

Well, not really. I am responding to the person who DID ask the
question.
Okay, I should have navigated back up to the original poster, but I
would have thought that it was pretty obvious to all but the most
pedantic pedant. :)

Navigating back up to the original post? Are you using Google?
Realize this is a newsgroup and it is important to reply to the
correct post.
You are correct.
According to O'Rielly's Definitive Guide to Javascript (3rd Edition),
document.referrer refers to the document which linked the current
document. What I meant to say was document.location, however, I see
this is deprecated so document.URL, should be used instead. Or, as you
suggest, window.location.


I don't see why. I often used to use zero width frames as a way of
keeping track of variables on a site without using cookies (an option
that the OP might also like to consider).

There's no need to keep track of it when you can pass it as part of
the URI.

[snip]
No, I am lucid. However, you are probably right in this case. Opening
new windows in today's climate of paranoia and pop-up blockers is very
likely ill-advised.
However, it DOES work, and in much the same way as the frames
technique works.

You missed the point.
Well, maybe....


Yes, you have forced me to realise that I was very unwise to post at
all on this forum.

It is unwise to post wrong answers, even if they include a disclaimer.
 

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,781
Messages
2,569,615
Members
45,295
Latest member
EmilG1510

Latest Threads

Top