Daniel Nease
Daniel Nease

Reputation: 31

html pattern attribute

I'm trying to limit my text input to only allow letters, not numbers. With a maximum of 100 characters. I'm having trouble finding out how to use the pattern attribute to only allow letters. Here is a portion of my code attempting this.

<form action="http://www.severien.com/grit/formecho.php" method="post" target="_blank">
        <label for="videorequests"> Video Requests:</label>
        <input type="text" id="videorequests" name="videorequests" maxlength="100" pattern="[a-z]{1,100}" />
        <input type="submit" value="Submit" class="submitbutton" />
    </form>

Using the attribute maxlength I'm limiting the character input to 100. How do I use pattern to limit the character use to only letters, excluding numerical characters?

Upvotes: 0

Views: 356

Answers (1)

t..
t..

Reputation: 1101

use this

pattern="[A-Z a-z]{1,100}" 

Upvotes: 1

Related Questions