INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

A href as submit

A href as submit

(OP)
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?

RE: A href as submit

Quote:

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

RE: A href as submit

(OP)
Sorry, this is just a snippet of the code.
I have all the complete tags.

RE: A href as submit

Okay, so we have a small part of the code, no idea how you are capturing the results, and no idea where this;

Quote:

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

RE: A href as submit

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> 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close