Accept Only Letters In A Field

Nov 24, 2002

Very simple, but useful - I just came up with this in answer to a post:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Letters ONLY</title>
<script type="text/javascript">
<!--
function alpha(e) {
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
}
// -->
</script>
</head>
<body>
<div>
<form id="example" action="javascript://">
<input type="text" onkeypress="return alpha(event)" />
</form>
</div>
</body>
</html>

View 14 Replies


ADVERTISEMENT

Setup A Textbox To Only Accept Specific Keys - Some Of The Function Keys Are Reading As The Same Values As Letters?

Oct 21, 2011

I am trying to setup a textbox to only accept specific keys. The problem is, some of the Function keys are reading as the same values as letters.Ex.

112 - F1 - p
113 - F2 - q
114 - F3 - r[code]....

Is there another way to allow the function keys without enabling all matching letters as well?

View 2 Replies View Related

Validate Correct Entry In A Field As Well As It Can Accept Empty Field?

Feb 9, 2011

that a javascript which is validating a phone number accepts only digits but if the text field is left empty it should accept the entry as an empty entry...

View 2 Replies View Related

Field That Can Only Accept Numbers?

Jan 27, 2009

provide the HTML/Javascript to ensure a field can only accept numbers? (I don't mean post-submit validation, but literally the field only accepts numerical input.)

View 4 Replies View Related

Field Validation Needs To Accept Decimal Values -- How Please?

Jul 20, 2005

I need this function to accept decimal values (e.g., 2.5 ok, not just whole numbers between 1 and 5).

I can't find this answer...

View 6 Replies View Related

Setting Text Field To Accept Only Alphabetical Characters?

Oct 26, 2008

I am unable to solve two problems creating a contacts form using dreamweaver CS3. My other problem is posted under the heading, "Modify code created with Dreamweaver CS3, to compare two text feilds". For this posting, can someone please tell me how to modify my code, pasted below, so that the "First Name" and "Last Name" text fields are restricted to accepting only alphabetical characters.

Here's my current code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

[Code]...

View 2 Replies View Related

Money Validation For A Field - Accept 2 Digits Decimal 000,000.00

Oct 15, 2010

I need to do javascript money validation for a field. the condtions are

1) depending on the Locale (not sure if this can be done in JS like US,Germany..)

2) verify if it has $,pound symbol, yen symbol..

3) group the digits either like 00,00,000 or 000,000,000

4) accept 2 digits decimal 000,000.00

View 1 Replies View Related

Not Accept Empty Field And Negative Values And Characters

Dec 13, 2010

I have a problem in asp application validation. My textbox only accepts numeric value.It should not accept empty field and negative values and charcters.I am not aware of IsNan function.

View 8 Replies View Related

Regular Expression :: Check A Text Field Value To Accept Between 0-20

Aug 6, 2005

i'm fairly new to regular expression and want to know if it's possible to check a text field value. I need to only accept value between 0 and 20. I've got also a problem with the 0 value ... guess the script think it's false :

if(!Number(document.data.f_cat_1.value) || document.data.f_cat_1.value > 20){
alert('Your must enter a numeric value between 0 & 20 pts!');
document.data.f_cat_1.focus();
return false;
}

View 1 Replies View Related

Check If First 2 Letters Equal Certain Characters In Input Field?

Jun 14, 2011

I am having trouble with some javascript code that checks the first 2 letters of what the user inputs and whether it equals a certain set of characters. If the user for instance types in 'TT' in an input field, then i want the holding div to disappear, if anything else is typed in then this action wont happen. My code is below:

Code:
<script type="text/javascript">
function checkCode() {
var x=document.forms["myform"]["code"].value.substring(0, 2);
if (x == 'TT')

[Code]...

I believe the problem lies in the javascript line: "if (x == 'TT')", as the rest of the script responds but it just doesnt recognise whether 'x' starts with 'TT'

View 3 Replies View Related

Value Search (find) To Database(table) Letters To Letters And Live?

Jul 13, 2011

i want a value search(find) to database(table), this requires an ajax call to a server page? if want show result search live(online) and search letters to letters (transliteration), how is it?

[Code]...

View 1 Replies View Related

Modify String - Lowercase Letters And Uppercase Letters In A String And Then Swap Them

Jan 19, 2010

I am currently trying to build a new function in javascript that is supposed to handle a string of text. The idea is that it should find the lowercase letters and uppercase letters in a string and then swap them.

Meaning all lowercase letter becomes uppercase letter and vice versa.

So i am just asking if someone could point me in the right direction or give some tips. I've currently been reading about the toUpperCase(); and toLowerCase(); functions and i am fairly confident i know how to use them for switching, however i still need a way to find the lower , upper character in the string so i later can switch them.

View 5 Replies View Related

Accept A Drag-and-drop File?

Jul 23, 2005

Is there a way to make it possible for an <input type=file> form element to accept a drag-and-drop file or will the browser window always accept the file?

View 1 Replies View Related

JQuery :: Getting Validate() Accept To Work?

Sep 27, 2011

I have the Validation plugin working fine other than the accept method. I can't seem to get it to fire. I have looked at the demos on the site but still can't get it to work. All the other fields with the class of 'required' get caught (when blank) and even the file gets caught (when blank) too, just not the file type.

[Code]...

View 1 Replies View Related

Accept Both Dots And Commas In Calculator?

Aug 2, 2010

I want to accept both commas and dots in my calculator. How to do this?

function compute(form)
{
get Index value for width
var wt = (form.width.options.selectedIndex)

[Code]....

View 6 Replies View Related

Textbox1 To Accept Only Numeric Data

Dec 8, 2011

I want textbox1 to accept only numeric data as 55,65,698.00 Is there any easy way to validate textbox1 with javascript?

View 3 Replies View Related

Can't Change A Var To Accept More Than One Character Input?

Sep 26, 2010

I'm trying to implement a OSC addon to update the options price in realtime fromww.oscommerce.com/community/contributions,1385, but it seems to only work with single characters currency symbols, like $, €, £, etc. any symbol that as more than one character, like Brazil Real R$, or C€, or Svenska Kronor Skr, doesn't work and the price doesn't update, it stays R$ 0.00 whatever options you choose.I need to use this contribution with the Brazil Real symbol at the left of price like R$ 999.00.Also I can't make it work like 10.000,00. It only works like 10,000.00. But this point is not so important.I have tried everything for some days, but I don't know javascript.Here is the code:

Code:
<script language="javascript">
<!--

[code]....

View 1 Replies View Related

JQuery :: Accept Only Numeric Digit In Texbox?

Apr 16, 2011

I want to create script which accept only numeric digit in textbox when user type alphabets nothing will appear in textbox and display error.

View 3 Replies View Related

JQuery :: Setting Accept When Uploading File?

Mar 21, 2011

I'm trying to upload a form via jquery forms plugin. Here's the form:

<form method="post" action="<spring:url value="/grouplist/uploadavatar.do" />" enctype="multipart/form-data" id="formUploadAvatar">
<table width="100%">
<tr>
td width="25%" style="padding-top: 30px; margin-top: 30px; ">

[Code]...

View 1 Replies View Related

JS To Accept Only A Particular String To Start With An Alphabet Or Number Only?

Jun 4, 2009

I have a JS function which checks whether the directory field value entered starts with an alphabet or number only. Following is the code using regular expression.

function testpw() {
var un = document.getElementById("dir").value;
if (/^[^A-Za-z0-9]/.test(un)) { // only a-z0-9 allowed as first character

[code]......

method which only accepts "/ktp/knas/" as the starting value and anything after that. ie it should accept /ktp/knas/*, rest everything is not accepted.

View 1 Replies View Related

Shouldn't This Function Accept Multiple Parameters?

Jun 19, 2011

I'm probably missing something simple here. I have this function called display:

function display(name3,office3,officePH3,mobile3,email3)
{
document.getElementById('viewer').src=('Location_Files/')+(office3)+('.htm')
}

It's supposed to take 5 values and do various things with them. When I only had one parameter it worked fine, it took an office number which was the value of a listbox option and turned it into a path and then pointed an iframe to that path. Then I changed it so the value of the listbox option was 5 parameters separated by commas. Here's the listbox now:

<select onchange="display(this.value)" multiple="multiple" id="People" name="People" style="border-style: none; height:260px; width:220px;">
<option value="test name,1656,phone,NONE,email">Loading</option>
</select>

You can see display is executed as "display(this.value)" so in theory it should take "test name,1656,phone,NONE,email" as its parameters and it should accept 1656 as the "office3" parameter. For some reason it's not working out that way, the function executes and the iframe changes but I get an unable to display webpage message like the path is broken. Can anyone see what I'm doing wrong?

View 2 Replies View Related

Username Verification - Accept Only A-z0-9 And _(underscore),-(hyphen) And .(dot)

Jul 19, 2011

I have written a function for accepting name and should be atleast minimum 4 characters. It is accepting all characters including special characters. Now i want my function to accept only a-z0-9 and _(underscore),-(hyphen) and .(dot) Below is my function

[Code]...

View 24 Replies View Related

JQuery :: Regex To Accept Float Number In A Textbox?

Jan 12, 2011

I need to restrict a range of values to a textbox. I have already the minimum and maximum value allowed in the textbox, but is missing me intermediate values.

An example: From the minimum value -2,00 to maximum value 0,00 it accepts: -2,00 | -1,75 | -1,50 | -1,25 | -1,00 | -0,75 | -0,5 | -0,25 | 0,00 From the minimum value 0,00 to maximum value 1,00 it accepts: 0,00 | 0,25 | 0,50 | 0,75 | 1,00

View 1 Replies View Related

JQuery :: Validate A Text Input To Not Accept Numbers

Aug 7, 2009

I have searched the internet and couldn't find a problem regarding this issue. The thing I want to do is simply validate a text input so when you enter a number in it, it won't validate and give you an error message. This is the code:

[Code]...

View 1 Replies View Related

JQuery :: Fields Will Accept Numbers With No Proceeding Digits

Apr 28, 2011

I need to edit the plugin so that the number fields will accept decimal numbers with no preceeding digits. For example, I need .8 to be valid [URL].

View 1 Replies View Related

Accept Two Numbers From A User And Will Determine Whether The Second Number Is A Factor Of The First

Oct 23, 2011

I have been presented with: Draw a flowchart and write a javascript program which will accept two numbers from a user and will determine whether the second number is a factor of the first. This is determined by dividing the first number by the second and checking if the remainder is 0. This is made easier if you find out what the operator does. The output should be in the form 4 is not a factor of 6 and 3 is a factor of 6. I have tried a few attemps and yet still not sure what the problem is :confused:

[Code]....

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved