Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / September 2007



Tip: Looking for answers? Try searching our database.

Javascript to include field on next form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
irkland@gmail.com - 29 Sep 2007 21:32 GMT
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
Thomas 'PointedEars' Lahn - 29 Sep 2007 22:23 GMT
> 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
Signature

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, <f806at$ail$1$8300dec7@news.demon.co.uk>

Cov - 30 Sep 2007 21:20 GMT
On Sep 29, 11:23 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
> irkl...@gmail.com wrote:
> > I've got a short form--1 field and a submit button. I want someone to
[quoted text clipped - 17 lines]
> the best source of advice on designing systems that use javascript.
>   -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk>

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.
David Mark - 30 Sep 2007 21:30 GMT
> On Sep 29, 11:23 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
> wrote:
[quoted text clipped - 20 lines]
> > the best source of advice on designing systems that use javascript.
> >   -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk>

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.
Cov - 30 Sep 2007 22:11 GMT
> 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. :)

> > I think you have 3 options.
>
[quoted text clipped - 5 lines]
> 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! :)
David Mark - 30 Sep 2007 23:09 GMT
> On Sep 30, 10:30 pm, David Mark <dmark.cins...@gmail.com> wrote:> Are you responding to PointedEars?  He didn't ask the question.
>
[quoted text clipped - 3 lines]
> 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.

> > > I think you have 3 options.
>
[quoted text clipped - 19 lines]
> 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]

> > 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
[quoted text clipped - 5 lines]
> However, it DOES work, and in much the same way as the frames
> technique works.

You missed the point.

> > Inaccurate for sure.  It can't be outdated as it was never accurate.
>
[quoted text clipped - 5 lines]
> 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.
Thomas 'PointedEars' Lahn - 30 Sep 2007 22:50 GMT
> [...]
> 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
Signature

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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.