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!

Asp w/ onlick 1

Status
Not open for further replies.

vatik

Technical User
Jul 13, 2001
20
0
0
US
I am looking to active an asp function through a html onclick handler. Below i have posted code to help show what im thinking, but if anyone could help make it work... that would be just swell.

<form action=&quot;record.asp&quot; method=&quot;link&quot;>
<input type=&quot;button&quot; value=&quot;modify&quot; onclick=&quot;test()&quot;>
</form>
<%
sub test
Response.write(&quot;testing&quot;)
end sub
%>
 
ASP can't get executed on the client-side, and this is by design. If you want to run client-side scripts, I would suggest using Javascript, since it's compatible across all browsers. If you need to use vbscript, you can, by doing this:

<script language=&quot;vbscript&quot;>
'do code here
</script>

note: you don't get any DB access on the client side, so if you want to be able to access your database, post back, and we'll offer you some workarounds.

good luck
leo
 
Yeah thats exactly what im trying to do. I am using as to display database information in a form. I want to have a form with information that can be modified and then have a modify button to execute the sql code for updating a record.
I am having one hell of a time figuring this out so i appreciate your help. I hope that is clear.

here is the pseudo code

Display form with current database fields
click modify
execute asp code to update the record
return to main page
 
what you can do is populate an array on the client-side, using ASP code, then manipulate that array.

ex:

<script language=&quot;javascript&quot;>
<%
Response.write &quot;var myArr[&quot; & RS.RecordCount & &quot;];&quot;
dim i
i = 0

while not rs.eof
Response.write &quot;myArr [&quot; & i & &quot;] = &quot; & RS(&quot;col&quot;) & &quot;;&quot;
i = i + 1
rs.movenext
wend
%>
</script>

that snippet of code assumes that you've created a recordset with a forwards and backwards scrolling cursor. This should populate a one dimensional array on the client side, and mimic the actual data set of the recordset itself.

hopefully that's enough to get you started in the right direction... also - you might want to check my javascript code, I haven't gotten the chance to test this, but it seems like all the errors will sit in syntax.

hope this helps
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top