...

View Full Version : Quick help, simple problem with form



LondonBoy
01-04-2007, 05:16 PM
My method isn't being called
plz let me know why?


<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
.style3 {font-size: 11px}
.style6 {font-size: 9px; font-weight: bold; }
.style7 {color: #009999}
-->
</style>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
function check(thisform) {
frm=thisform
var act =document.frm.activity.value ;
var otheract = document.frm.otheract.value;
alert("The Activity you selected is Not Valid")
if ( act.value=="99999" && otheract.value=="")
{
alert("The Activity you selected is Not Valid")
document.frm.activity.focus();
}
else{
document.frm.submit();
}
}
</script>
</head>


<form METHOD="POST" ACTION="registertry.asp" onsubmit="return check(this)">
<tr>
<td height="30" colspan="2" align="center" valign="middle">


<b><u>STEP 1</u></b> </td>
</tr>

<tr bgcolor="#018CAD">
<td height="18" colspan="2" align="center" valign="middle"><font color="#FFFFFF"><strong>Choose your Activity.</strong></td>
</tr>

<tr bgcolor="#E1E1F0">
<td width="172" height="30" align="right" valign="middle"><strong>Activity:</strong><font color="#FF0000"> *</font></td>
<td width="228" align="left" valign="middle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select name="Activity" style="width:auto" >
<option value="99999">---Select an activity---
<% Set ActivityList = Conn.Execute("SELECT Name FROM Activity ORDER BY Name") %>
<%DO WHILE NOT ActivityList.EOF %>
<%IF TRIM(UCASE(LocActivity))= TRIM(UCASE(ActivityList("Name"))) THEN%>
</option>
<option value="<%=ActivityList("Name")%>" selected> <%=ActivityList("Name")%>
<%ELSE%>
</option>
<option value="<%=ActivityList("Name")%>"> <%=ActivityList("Name")%>
<%END IF%>
<%ActivityList.MoveNext
LOOP %>
</option>
</select></td>

Thompson
01-04-2007, 10:33 PM
Look: onsubmit="return check(this);"

This means that the function check() must return true or false only.

put return false; in place of document.frm.activity.focus();, and put return true; in place of document.frm.submit();

This should work. If not, come here again :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum