a problem with a form

J

james

I hoping someone can help me.

What I have is a series of drop down forms, they are dates and other things.
What I need to do is get these values and input them into a URL string in a
certain order.

I have been trying to get this to work for ages. I think I have the function
done correctly for the for I just can not get it into the url string.

Can someone please help

James
 
L

lallous

Hello,

james said:
I hoping someone can help me.

What I have is a series of drop down forms, they are dates and other things.
What I need to do is get these values and input them into a URL string in a
certain order.

I have been trying to get this to work for ages. I think I have the function
done correctly for the for I just can not get it into the url string.

After you have formed the URL into a string you can pass it to URL as:
location = myNewUrl;
Fetch more info about the 'location object' in some online reference.
 
R

Richard Cornford

james said:
What I have is a series of drop down forms,

A "drop down form"? That's a new one, you may have to
elaborate/illustrate.
they are dates and other things. What I need to do is get
these values and input them into a URL string in a
certain order.

The order of the name value pairs in a query string should not matter in
the slightest. Unless someone has done a really bad (deliberately
stupid) job of authoring the CGI script it is sent to, in which case
they should be told to fix it.

A form, provided with an ACTION attribute set the URL of the CGI script
and a METHOD attribute set to GET will, when submitted, automatically
append the query string to the URL, suitably encode the data as
required, and make a GET request to the CGI script with the resulting
URL. The exact order of the name value pairs should reflect the order of
the named form elements in the HTML, though I wouldn't rely on that,
but, as I have said, the order should not be important at all.
I have been trying to get this to work for ages. I think I
have the function done correctly for the for I just can not
get it into the url string.

If you want help changing code that you have written so that it does
what you want it to do you will have to allow access to the code, and
provide an HTML context in which it can be tested. (that is: post the
code or the URL of an online version so people can have a look at it).

Richard.
 
E

Evertjan.

james wrote on 10 dec 2003 in comp.lang.javascript:
I hoping someone can help me.

What I have is a series of drop down forms, they are dates and other
things. What I need to do is get these values and input them into a
URL string in a certain order.

I have been trying to get this to work for ages. I think I have the
function done correctly for the for I just can not get it into the url
string.

Others will tell you why it is not very necessary,
I will show you it van be done,
forgetting even to use the <form> element:

<SELECT id="first">
<OPTION value="1">one
<OPTION value="2">two
</SELECT>

<SELECT id="second">
<OPTION value="3">three
<OPTION value="4">four
</SELECT>

<button onclick="doURL()">
do it
</button>

<script>
function doURL() {
nfirst=document.getElementById("first").value
nsecond=document.getElementById("second").value
t="http://thisismysite.com/second="+nsecond+"&first="+nfirst
alert(t)
location.href=t
}
</script>
 
J

james

Thanks for that, It works great, is there anyway I can get it to do
something simillar to target="_blank"?
 
E

Evertjan.

james wrote on 10 dec 2003 in comp.lang.javascript:
Thanks for that, It works great, is there anyway I can get it to do
something simillar to target="_blank"?

[Please do not bottomquote on usenet]

sure, exchange:

location.href=t

with:

window.open(t,"_blank","")
 

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,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top