SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    this shouldn't be so hard...

    I have username and password text boxes, Im trying to make sure they dont just have a space in them that they have data. How is this done?

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    if (inputElement.value.search(/^\s*$/)!=-1)
    seems like the easiest way to me. (not tested)
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #3
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how come my form wont even call the validate function onSubmit?
    it calls it but doesn't do much
    Code:
     
    <%@LANGUAGE="JAVASCRIPT"%>
    <%
    Session("HandHeldObject" )= null
    Session("HandHeldObject" )= Server.CreateObject("HandHeldItemMaint.HandHeldATL" );
    Session.Timeout = 300 //5 hours 
    var objHandHeld = Session("HandHeldObject" );
    if (Session("HandHeldObject" ).Open() == false){ 
    %>
    <script language="JavaScript">
    alert("ERROR: " + "<%=objHandHeld.ErrorMessage%>" ); 
    </script>
    <%
    } //<--FROM ABOVE IF
    %>
    <html>
    <head>
    <title>Hand Held Logon</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">
    function validate() { 
    alert("testing" );
    if( (document.form.username.value.length <=0) || 
    (document.form.username.value.value == "Username" ) )
    { 
    alert("Enter a usernumber" ); 
    document.formhandheld.username.value = "Usernumber"; 
    document.formhandheld.username.focus(); 
    var authenticate = true; 
    
    if (authenticate == true) { 
    return false; 
    } 
    else { return true; 
    } 
    } 
    }
    </script>
    </head>
    <body bottommargin="0" topmargin="0" rightmargin="0" leftmargin="0">
    <!--code to stop keypad from coming up / DOESNT WORK -->
    <OBJECT ID="txtNoSIP" CLASSID="clsid:A72D105-40C2-11D6-918E-00C0DF232EEE" width="95" height="20">
    <PARAM NAME=VALUE VALUE="">
    <PARAM NAME=MAXLENGTH VALUE=30>
    <PARAM NAME=ALIGNMENT VALUE=LEFT>
    </OBJECT>
    <SCRIPT language="JavaScript" FOR="txtNoSIP" EVENT="OnFocus()">txtNoSIP.ShowSIP(false);</SCRIPT>
    <SCRIPT language="JavaScript" FOR="txtNoSIP" EVENT="OnLostFocus()">txtNoSIP.ShowSIP(false);</SCRIPT>
    <form name="formhandheld" action="pocketLogInProcess.asp" method="post" onSubmit="return validate()"> 
    <table width="225" height="320" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td bgcolor="#e3e3e3" valign="top">
    <table width="100%" height="320" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td bgcolor="#e3e3e3" height="*" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td colspan="2" align="center" bgcolor="#00CC33">
    <font size='-1' face='verdana,arial'><%=objHandHeld.ItemTitle%></font>
    </td>
    </tr>
    <tr>
    <td>&nbsp;</td><td>&nbsp;</td>
    </tr>
    <tr>
    <td colspan="2"><font face='verdana,arial'>Please Sign On</font></td>
    </tr>
    <tr>
    <td><font face='verdana,arial'>User Number:</font></td>
    <td align="right"><input name="username" type="text" size="15" maxlength="9"></td>
    </tr>
    <tr>
    <td height="19" ><font face='verdana,arial'>Password:</font></td>
    <td align="right"><input name="password" type="password" size="15" maxlength="4"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td bgcolor="#999999" height="28"><div align="center">
    <input type="submit" name="OK" value="&nbsp;&nbsp;&nbsp;OK&nbsp;&nbsp;&nbsp;">
    <input type="reset" name="Cancel" value="&nbsp;&nbsp;Cancel&nbsp;&nbsp;">
    <input type="button" name="Help" value="&nbsp;&nbsp;&nbsp;Help&nbsp;&nbsp;&nbsp;" onClick="window.location.href="pocketLogin_Help.asp"">
    </div></td>
    </tr>
    </table></td>
    </tr>
    </table></form>
    </body>
    </html>

  4. #4
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nevermind


Bookmarks

Posting Permissions

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