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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace Javascript with ASP function somehow 1

Status
Not open for further replies.

gradinumcp

IS-IT--Management
Apr 6, 2005
85
US
Hey there...I have a perfectly working code where i click a button and the onclick--directs it to a javascript function based on if there is a record in the DB or not. However my boss suggested I not use javascript and do the same with asp....any clues?

<form name="Page1" method="post">
<table>
<tr>
<td>

<% 'Check if record exists in servicing export table

mySQL = "SELECT * FROM ServicingExportFields where loannum='"&rs("Loannum")&"'"
Set RecordCounter = Con.Execute( mySQL )

if RecordCounter.eof<>true then%>
<script language = JavaScript>
function ServiceCheck(tbl, loannum, val)
{
alert("In database")

window.open("Update.asp?tbl="+tbl+"&loannum="+loannum+"&val="+val, target="_main");
}
</script>

<%else%>

<script language = JavaScript>
function ServiceCheck(tbl, loannum, val)
{
alert("Not in Database ")
window.open("Update.asp?tbl="+tbl+"&loannum="+loannum+"&val="+val, target="_main");
}
</script>

<%end if%>

<td <%=BGCOL%>><input type="text" name="WareHouseNumber<%=RS("loannum")%>"><input type="button" Name='Stamp' value='Stamp'onclick="ServiceCheck('DM01', '<%=RS("loannum")%>', document.Page1.WareHouseNumber<%=RS("loannum")%>.value);"></td>
 
you cannot explicitly do an alert in ASP, that will need to stay as JavaScript (if it's even needed). The window.open can easily be replaced with [tt]Response.Redirect(urlGoesHere)[/tt].



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
sorry, the caveat is that the [tt]Response.Redirect[/tt] will open the url in the same window. you can get around this, however, depending on how your function is being called.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thanks Cory.....Its weird..the current code works fine...god knows why i need to change it...any other ideas or better ways of doing it???
 
Ya that makes sense. Okay I will go with response.redirect...Thanks again:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top