473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Passing value of a text box in a href tag

Hi all,

In a form I have a text called myText as input and need to pass its value to
the next page (mySecond.asp)
The following works fine and my next page I get the value of myText=test:
<a href="mySecond.asp?MyText=test">click here</a>
But, I need to pass document.myform.myText.value instead of test value.
I have problem with the syntax. I'm sure I need to use javascript, but how?
Thanks in advance,

Roy
Feb 6 '07 #1
2 5259
You could use a normal HTML FORM (anyone remember those? :) )

<form method="GET" action="mySecond.asp">
<input type="text" name="MyText">
<input type="submit" value="Go">
</form>

The alternative would be to do a normal asp.net postback, read the value
then Response.Redirect to the new URL.

"Roy" <Ro*@discussions.microsoft.comwrote in message
news:B5**********************************@microsof t.com...
Hi all,

In a form I have a text called myText as input and need to pass its value
to
the next page (mySecond.asp)
The following works fine and my next page I get the value of myText=test:
<a href="mySecond.asp?MyText=test">click here</a>
But, I need to pass document.myform.myText.value instead of test value.
I have problem with the syntax. I'm sure I need to use javascript, but
how?
Thanks in advance,

Roy

Feb 6 '07 #2
Hi Roy,

<input type="text" id="myText"/>
<a href="javascript:RedirectToSecondPage()">click here</a>

<script type="text/javascript">
function RedirectToSecondPage()
{
var input = document.getElementById('myText');
var value = input ? input.value : 'defaultText';

window.location.href = 'mySecond.asp?MyText=' + escape(value);
}
</script>
--
Milosz
"Roy" wrote:
Hi all,

In a form I have a text called myText as input and need to pass its value to
the next page (mySecond.asp)
The following works fine and my next page I get the value of myText=test:
<a href="mySecond.asp?MyText=test">click here</a>
But, I need to pass document.myform.myText.value instead of test value.
I have problem with the syntax. I'm sure I need to use javascript, but how?
Thanks in advance,

Roy
Feb 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Duane Phillips | last post by:
How do I write a hyperlink that also passes a value to the destination php page? Thanks in advance. ~Duane.
1
by: mikea_59 | last post by:
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value>
4
by: Xerxes | last post by:
Hi all, I am trying to pass a value of a field as an argument to href but I am not doing it right: <select name="sel_name" id="sel_id"><option>....</option>.... <a...
2
by: sangram | last post by:
Passing value from parent to child window created by Pop up
4
idsanjeev
by: idsanjeev | last post by:
SIR I AM PASSING VALUE FROM ONE FORM TO ANOTHER FORM THROUGH COOKIES BUT IS CAN ONLY TRANSFER LAST VALUE HOW CAN PASS VALUE AFTER CLICKIN ON LINK I AM USING THE CODE IS FOR LINK <td><a...
6
by: iDesmet | last post by:
Good day! I was wondering if someone could show me the way with this little problem I have. I need to get the value/text of every checked SubItems in a listview so I can execute a Sub. The...
1
by: sva0008 | last post by:
hi , I am using. <input type=button class=tbox value="Populate SA" style="width: 90%"...
10
by: perhapscwk | last post by:
how to passing value from popup to the parent window as a variable which I can access and process the variable(string) in parent window? such as from popup page, we have var_from_popup="abc",...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.