[Javascript] passing values in a link

Ben ben at babelfish.co.uk
Mon May 14 10:02:08 CDT 2001


You need to tell the form which page it is submitting the data too.

    <form name="myform" method="Get" action="thispage.asp">

You can pass data from page to page using your method (by building up the
querystring yourself) but in this case there is no need.

hope this helps.

  .b

----- Original Message -----
From: "Varsou Nilsa" <nvarsou at infoserve.gr>
To: <javascript at LaTech.edu>
Sent: Monday, May 14, 2001 3:10 PM
Subject: [Javascript] passing values in a link


Hi everyone, I need some help, I am trying to pass a key value in a href
link, I have done this before and I just don't get why is not working,
the truth is I am a begginer in jscript, bellow I have my code, when I
click the "take me there" link to de default.htm page I want to pass a
key with the value of the T1.field on it, instead of this the link take
me to the default page with a null key something like default.htm?key=,
yet when I put a default value to the key (something like
href="default.htm?key=" + 4) the result is still the same, what am I
doing rong?
TIA

<form name="myform" method="Get">
  <p><input type="text" name="T1" size="20">
  <p><input type="text" name="T2" size="20">
   <p>
   <input type="radio" name="showView" id=showView value="0"><label
for="showAll" id="label1">
      Show all </label>
        </p>
  <p>
   <input type="radio" name="showView" id=showView value="1"
checked><label for="showFiltered " id="label2">
      Filter </label>
        </p>
</form>
<script language="javascript">
function validate(){
if(document.myform.showView(0).checked){
document.myform.T1.value == "";
document.myform.T2.value == "";
}

if(document.myform.showView(1).checked){
if(document.myform.T1.value == "" &&
document.myform.T2.value == ""){
alert("Sorry, you must fill at least one of the
fields.");
return false;
}
document.myform.submit();
  }
}

</script>

<p><a href="default.htm?key=" + document.myform.T1.value onClick="return
validate()">take me there</a></p>






Nilza Da Silva Varsou
Web Developer

INFOSERVE SA
145 Vizantiou str.
GR 142 35, Kalogreza
Athens, Greece
Tel. +30-1-2595300
Fax +30-1-2595301
-------------------------------
www.infoactivity.com
eCRM application
-------------------------------


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript






More information about the Javascript mailing list