简体   繁体   中英

Form validation without javascript

I want to validate 7 alphanumeric for 1 part of my form but it keeps telling me to follow the format even when I use pattern="[a-zA-Z0-9]" .

Here is my code :

<div class="control-group form-group">
    <div class="control">
        <label for="admin">Admin Number:
            <input type="text" class="form-control" id="admin" name="admin" placeholder="eg. 123456A" required pattern="\[a-zA-Z0-9]{7}"/>
        </label>
    </div>
</div>

and just asking but is it possible to validate radio box without javascript

I changed it to this and now it seems to be working:

<div class="control-group form-group">
<div class="control">
    <label for="admin">Admin Number:
    <input type="text" class="form-control" id="admin" name="admin"  placeholder="eg. 123456A" pattern="[0-9A-Za-z]{7}"/>
</label>
</div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM