Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quick help, simple problem with form

    My method isn't being called
    plz let me know why?

    Code:
    <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>
    Code:
     <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>

  • #2
    New Coder
    Join Date
    Mar 2006
    Location
    São Paulo, Brazil
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    ----
    As coisas mais simples são as mais importantes.
    ---------
    Thompson M1A1: D-Day
    ----------------


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •