View Full Version : Quick help, simple problem with form

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

<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}
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
function check(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")

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

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

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

<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 value="<%=ActivityList("Name")%>" selected> <%=ActivityList("Name")%>
<option value="<%=ActivityList("Name")%>"> <%=ActivityList("Name")%>
<%END IF%>

01-04-2007, 09: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