Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A href as submit

Status
Not open for further replies.

malaygal

IS-IT--Management
Feb 22, 2006
192
US
I have this asp code on my page

<%
rs2.movefirst

while not rs2.eof
%>
<input type="hidden" value ="<%=rs2("set_id")%>-<%=rs2("set_name")%>" name = "lnksched"><a href="#" onclick="document.forms[0].submit();return false;"><%=rs2("set_name")%></a><br>

<%
rs2.movenext

wend
%>

that translate to this

<input type="hidden" value = "1-Assets" name = "lnksched"><a href="#" onclick="document.forms[0].submit();return false;">Assets</a>


<input type="hidden" value = "2-Liabilities" name = "lnksched"><a href="#" onclick="document.forms[0].submit();return false;">Liabilities</a>


<input type="hidden" value = "3-Profit" name = "lnksched"><a href="#" onclick="document.forms[0].submit();return false;">Profit</a>


<input type="hidden" value = "4-Loss" name = "lnksched"><a href="#" onclick="document.forms[0].submit();return false;">Loss</a>

When I click on each link, I expect to pass the individual value, but I am getting this string everytime: 1-Assets,2-Liabilities,3-Profit,4-Loss

How can I pass just the value of the link I clicked?
 
When I click on each link, I expect to pass the individual value,

How where you hoping to do that with no form tags anywhere?


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Sorry, this is just a snippet of the code.
I have all the complete tags.
 
Okay, so we have a small part of the code, no idea how you are capturing the results, and no idea where this;
but I am getting this string everytime: 1-Assets,2-Liabilities,3-Profit,4-Loss
is appearing, because we have no way of seeing the rendered HTML.

Man! We are programmers NOT clairvoyants.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
You don't need four hidden values, just one, and assign a value depending on what is linked. Not tested, and my javascript might be way off, but something like this should work:

Code:
<input type="hidden" value="" name="lnksched" id="lnksched">
<a href="#" onclick="document.getElementById('lnksched').value='1-Assets';document.forms[0].submit();return false;">Assets</a>
<a href="#" onclick="document.getElementById('lnksched').value='2-Liabilities';document.forms[0].submit();return false;">Liabilities</a>
<a href="#" onclick="document.getElementById('lnksched').value='3-Profit';document.forms[0].submit();return false;">Profit</a>
<a href="#" onclick="document.getElementById('lnksched').value='4-Loss';document.forms[0].submit();return false;">Loss</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top