GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   form input minimum length (https://gfy.com/showthread.php?t=958044)

Supaflyz 03-12-2010 07:12 AM

form input minimum length
 
Been searching on google for a form validator like the old tgp/mgp sites used to have.

It would tell you how many characters you had typed, and show in red or green when you had inputted enough characters for form to be submitted.

If anyone has a link be much appreciated.

BJ 03-12-2010 07:19 AM

I only have purple or orange

cyber 03-12-2010 07:58 AM

Code:

<script language="javascript" type="text/javascript">
function verifyLength(str, num, checkID){
  var str = document.getElementById(str).value;
  var good = "Your input is long enough";
  var bad = "Your input is too short";

  if(str.length >= num){
    document.getElementById(checkID).innerHTML = good;
    document.getElementById(checkID).className = "verify"
  }
  else{
    document.getElementById(checkID).innerHTML = bad;
    document.getElementById(checkID).className = "verify red"
  }
}
</script>

Usage:

Code:

    <div>
      <label>Password. Minimum 6 characters.<br />
        <input type="password" name="registerFormPassword" id="registerFormPassword" class="field" value="" tabindex="3"
          onkeyup="javascript:verifyLength('registerFormPassword', '6', 'verifyLengthregisterFormPassword');" />
      </label>
      <br />
      <span id="verifyLengthregisterFormPassword" class="verify">&nbsp;</span>
    </div>

Check my signature for custom PHP/Javascript/MySQL programming!

seeandsee 03-12-2010 08:01 AM

js for the win

Supaflyz 03-12-2010 03:46 PM

Thanks very much, i'll try that code out.

fris 03-12-2010 06:58 PM

try some jquery action

http://speckyboy.com/2009/12/17/10-u...d-tutorials-2/


All times are GMT -7. The time now is 04:05 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc