开发者

cfinput minimum password length

How can the cfin开发者_如何学编程put tag be set to validate the minimum input length? (E.g. To a minimum of 8 characters long)

Currently have:

<cfinput type="password" name="password " label="Password" required="yes" 
      message="Please Enter Your Password"> 


You can also use Regular Expression which will validate for a pattern with length between 8 and 16, allowing upper and lower case letters, numbers, periods, and underscores.

<cfinput type="password" name="password " label="Password" required="yes" validate="regex" pattern="^[a-zA-Z0-9._]{8,16}$" message="Please Enter Your Password">


       <script>
        function validatePassword(pass) {   
            //custom javascript code
            alert(pass.length);
        }
        </script>

        <cfform name="registration">
        <cfinput id="password" 
                type="password" 
                name="password" 
                label="Password" 
                required="yes" 
                message="Please Enter Your Password" 
                onkeyup="javascript:validatePassword(this.value);" />
        </cfform>

Or something like that... Just disable submit button until you get upto 8 chars, and/or display some red/green info etc...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜