Passing content of a text field to another page

S

Steve Pugh

Jerry Manner said:
Hi, i am also not an expert. I have visited the url you mentioned in
your post. From that website I concluded that I should use the form tag
with the method and action attribute to place the extra string at the
end of the url of the webpage I am going to.

<FORM action="ResultFrame.htm" method="get">
<input type="text" name="T1" size="40">
<a href="ResultFrame.htm" target="_top"><img border="0" src="Knop.gif"
width="129" height="18"></a>
</FORM>

How is anyone supposed to submit that form?
I have tried this code. I was assuming that I would see the url (
ResultFrame.htm) and then a question mark and then the content of the
text field, but that was not the case. Please correct me if I am
tottaly of track.

As the form can't be submitted you must have followed the link
instead. Your code is (some margins aside) no different to this:

<FORM action="ResultFrame.htm" method="get">
<input type="text" name="T1" size="40">
</FORM>

<a href="ResultFrame.htm" target="_top"><img border="0" src="Knop.gif"
width="129" height="18"></a>

See?
I know how to get the url adress of the visitingpage and then use
javascript to get a part of that url ( with the extra string). But I
still cannot open an url with attach to the address an extra string.

<FORM action="ResultFrame.htm" method="get">
<input type="text" name="T1" size="40">
<input type="image" src="Knop.gif" width="129" height="18"
alt="Submit">
</FORM>

Steve
 
L

Louise Balmforth

Pressing enter in input field. I wouldn't be surprised if somebody would
try to click image instead...

Reading this thread it appears to me that Jerry is new to website creation
and serving, a position I remember well, although the process of creating/
publishing pages is reasonably simple once you know how, getting started in
that direction appears incredibly complex. Help and assistance is what is
needed, I fail to see where this comment meets that criteria :-S

A regular button does not submit the form, but can be used to invoke an
applet to manipulate or validate the form.

A button of type="submit" or type="image" is required to submit the form.

I would say that 99.9% of people would try clicking the image, especially if
the image is as i suspect a submit button.

I have played around with the javascript from the url I posted previousely,
and have solved my problem with it, admittedly it requires the viewer to
have JS enabled but for my particular application it is not really a problem
if this is not the case as it is just a 'fun' flash movie purely for winding
up people in chat :))

Persevere Jerry, eventually it will all fall into neatly into place.

Louise
www.bratpack.org.uk
 
J

Jerry Manner

<Reading this thread it appears to me that Jerry is new to website
creation
<and serving, a position I remember well, although the process of
creating/
<publishing pages is reasonably simple once you know how, getting
started in
<that direction appears incredibly complex. Help and assistance is what
is
<needed, I fail to see where this comment meets that criteria :-S

<A regular button does not submit the form, but can be used to invoke
an
<applet to manipulate or validate the form.


<A button of type="submit" or type="image" is required to submit the
form.


<I would say that 99.9% of people would try clicking the image,
especially if
<the image is as i suspect a submit button.


<I have played around with the javascript from the url I posted
previousely,
<and have solved my problem with it, admittedly it requires the viewer
to
<have JS enabled but for my particular application it is not really a
problem
<if this is not the case as it is just a 'fun' flash movie purely for
winding
<up people in chat :))


<Persevere Jerry, eventually it will all fall into neatly into place.

Hi Louise

To be honest I have not tried your suggestion. I did try the suggestion
of Steve Pugh. I have used this code:

<FORM action="ResultFrame.htm" method="get">
<input type="text" name="T1" size="40">
<input type="image" src="ZoekKnop.gif" width="129" height="18"
alt="Submit">
</FORM>

If I click the image, it opens the next page with in the addresbar the
pageadress with ( behind the '?') the content of the text field. But
now I am facing another 'problem'. On the opened page I use the
javascript function 'document.URL' to show the complete adress of the
page.
But the adress that is shown is without the extra string ( so without
the '?' and the text from the text field).
How can I retrieve the complete adress of the page ( with the extra
string) using javascript?

Regards
 
L

Lauri Raittila

in alt.html, Jerry Manner wrote:

[snipped badly quoted last post. please fix your settings.]
But the adress that is shown is without the extra string ( so without
the '?' and the text from the text field). javascript function
'document.URL' to show the complete adress of the page.

Wrong function. I don't know right one, but it was mentioned here or
ciwa* within 2 days.
How can I retrieve the complete adress of the page ( with the extra
string) using javascript?

Why do you want to use javascript? it would be easier and much better to
use some server side language.
 
L

Louise Balmforth

To be honest I have not tried your suggestion. I did try the suggestion
of Steve Pugh. I have used this code:

<FORM action="ResultFrame.htm" method="get">
<input type="text" name="T1" size="40">
<input type="image" src="ZoekKnop.gif" width="129" height="18"
alt="Submit">
</FORM>

Thats the same thing, you have used the type="image" button which will
submit the form..
If I click the image, it opens the next page with in the addresbar the
pageadress with ( behind the '?') the content of the text field. But
now I am facing another 'problem'. On the opened page I use the
javascript function 'document.URL' to show the complete adress of the
page.
But the adress that is shown is without the extra string ( so without
the '?' and the text from the text field).
How can I retrieve the complete adress of the page ( with the extra
string) using javascript?

You dont use the document.URL function to retrieve the query string.

<script language="JavaScript">
<!-- // Begins
var i, inp = self.location.search.substr(1);
var queryString = new Object();
if (inp.length > 0) {
var ary = inp.replace(/\+/g, " ").split("&");
for (i in ary) {
ary = unescape(ary).split("=");
queryString[ary[0]] = ary[1];
}
}
// Ends -->
</script>

This will extract any number of variables passed with in the query string
into the querystring [] aray.

Check http://www.faqts.com/knowledge_base/view.phtml/aid/9574/fid/53 again,
this describes how to access the data passed.

As for how you then use the information, dont ask lol. I assume,
Document.write (querystring ["T12]) would output it but no promises. I am
reasonably ok with HTML but JS is an entirely different kettle of fish, and
maybe bordering on OT as this is alt.html.

Louise
www.bratpack.org.uk
 
J

Jerry Manner

<Why do you want to use javascript? it would be easier and much better
to
<use some server side language

I run this website locally. So I cannot use a serverside language. Is
there no way to do this without a server?
 
J

Jerry Manner

<Why do you want to use javascript? it would be easier and much better
to
<use some server side language

I run this website locally. So I cannot use a serverside language. Is
there no way to do this without a server?
 
J

Jerry Manner

<Why do you want to use javascript? it would be easier and much better
to
<use some server side language

I run this website locally. So I cannot use a serverside language. Is
there no way to do this without a server?
 
J

Jerry Manner

<Why do you want to use javascript? it would be easier and much better
to
<use some server side language

I run this website locally. So I cannot use a serverside language. Is
there no way to do this without a server?
 
M

mbstevens

Jerry said:
<Why do you want to use javascript? it would be easier and much better
to
<use some server side language

I run this website locally.

Do you mean a small local area network? Normally even that
would have a server, unless you have some kind of file sharing
like NFS or Samba set up.

So I cannot use a serverside language.

If it is on the Internet, it has a server.
You don't need to own the server.
You need server side privileges.
If your host doesn't give you those privileges, it's time
to bite the bullet and buy better web hosting. Depending
on javascript hacks just doesn't cut it.
Is
there no way to do this without a server?

Javascript is not allowed to write anything
to 'maintain state' except to set cookies. If you can set a cookie,
then you can later retrieve it and display it. Modules like
Perl's CGI.pm have better ways of 'maintaining state'.
Do a google search using the phrase to get an overview.

And get better hosting.
 
S

Steve Pugh

Lauri Raittila said:
Wrong function. I don't know right one, but it was mentioned here or
ciwa* within 2 days.

Yes, yesterday I wrote:

"window.location.search will return everything after the ? as a
string, you can then manipulate that string as you like."

This was in a message that (thanks to GG) I managed to e-mail to Jerry
before posting here, and he even replied to the e-mail so I would have
thought that he had actually had the chance to read it. But who knows?

Steve
 
N

neredbojias

Without quill or qualm, Jerry Manner quothed:
<Why do you want to use javascript? it would be easier and much better
to
<use some server side language

I run this website locally. So I cannot use a serverside language. Is
there no way to do this without a server?

Yes. You can use the javascript "location.search" function.

Here is a quote from a javascript book:

"The search property of the Location object represents the query portion
of the URL including the preceding question mark."

It's really pretty easy to pick-off the designated string:

var x=location.search;
x=x.slice(1); //to remove ?
 

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
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top