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

I need help with this code.

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
Can anybody figure out why the function verifyarea doesn't get executed when the submit image (button) is clicked.

Any help will be greatly appreciated.

<%@ Language=VBScript%>
<% Option Explicit %>
<% Response.Buffer=True %>
<% Response.CacheControl=&quot;no-cache&quot; %>
<% Response.Expires=-5000 %>
<%
dim prpt
dim ptemplate
dim pview
dim pfmt

prpt = request.querystring(&quot;rpt&quot;)
ptemplate=request.querystring(&quot;template&quot;)
pview=request.querystring(&quot;View&quot;)
pfmt=request.querystring(&quot;fmt&quot;)

%>

<script language=&quot;javascript&quot;>
function verifyarea()
{
var area_no = document.areaform.area_no.value
if ((area_no == '') || (area_no == ' '))
{
alert(&quot;Please enter area number.&quot;)
document.areaform.area_no.focus()
return false
}
return true;
}
</script>
<body bgcolor=&quot;white&quot; text=&quot;black&quot;>
<form name=&quot;areaform&quot; action=GenReport.asp?view=<%=pview%>&template=<%=ptemplate%>&rpt=<%=prpt%>&fmt=<%=pfmt%> method=&quot;post&quot; onsubmit=&quot;return verifyarea();&quot;>
<center>
<table>
<tr><td>Enter Area Number:</td><td><input type=&quot;text&quot; name=&quot;area_no&quot; maxlength=&quot;5&quot; >
<tr><td>Select Period:</td><td>
<select name=&quot;period&quot;>
<option value=&quot;Jan&quot;>Jan</option>
<option value=&quot;Jan&quot;>Feb</option>
...
</select></td>
<tr><td>Select Version:</td><td><input type=&quot;text&quot; name=&quot;version&quot; maxlength=&quot;5&quot;></td
<tr><td><input type=&quot;image&quot; src=&quot;bsubmit.gif&quot; onclick=&quot;verifyarea()&quot;>
</table>
 
because you cannot use the image tag like that try a href instead. the image tag is for submiting only so the only way you could do this the way you are trying is a onSubmit from the form tag
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top