473,320 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

formatting text input

Ike
Does anyone know where I can find example scritp for formatting text input?
I want to have a text box where only legitiamte filesname under unix can be
netered (no whitespace, only alphanumeric, must start alpha) -Ike
Jul 20 '05 #1
3 2301
Ike wrote on 06 mrt 2004 in comp.lang.javascript:
Does anyone know where I can find example scritp for formatting text
input? I want to have a text box where only legitiamte filesname under
unix can be netered (no whitespace, only alphanumeric, must start alpha)


testresult = /^[a-z][a-z0-9]*$/i.test(filename)

what about a period [.] ?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
Ike
I dont understand though....how do you incorporate that into a text element
on a form? Thank You -Ike

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Ike wrote on 06 mrt 2004 in comp.lang.javascript:
Does anyone know where I can find example scritp for formatting text
input? I want to have a text box where only legitiamte filesname under
unix can be netered

(no whitespace, only alphanumeric, must start alpha)


testresult = /^[a-z][a-z0-9]*$/i.test(filename)

what about a period [.] ?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 20 '05 #3
Ike wrote on 06 mrt 2004 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Ike wrote on 06 mrt 2004 in comp.lang.javascript:
> Does anyone know where I can find example scritp for formatting
> text input? I want to have a text box where only legitiamte
> filesname under unix can be netered
> (no whitespace, only alphanumeric, must start alpha)


testresult = /^[a-z][a-z0-9]*$/i.test(filename)

what about a period [.] ?

I dont understand though....how do you incorporate that into a text
element on a form? Thank You -Ike


[please do not toppost on usenet]

That depends on what you want to achieve.
I hope you try to experiment awith and learn something from this.

<script>
function test(x){
unix = x.unix.value
if(/^[a-z][a-z0-9]*$/i.test(unix)){
// (no whitespace, only alphanumeric, must start alpha)
return true // submit allowed
}
alert("Not an allowed string") // warning
return false // submit prevented
}
</script>

<form onsubmit="return test(this)">
<input name=unix>
<input type=submit>
</form>

IE6 tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan Weeb | last post by:
Hi All, I have struggled through this far with help from many of you so thanks. I am stuck again. I am really new to this so don't be harsh :-) There are a few problems. You can run the script...
4
by: j.t.w | last post by:
Hi All. I'm having a problem with my Date of Birth textbox. When I open the ..htm file, the "DoB" textbox is flat with a border. All of my other textboxes are sunken and are yellow. When I...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
7
by: ilona | last post by:
Hi all, I store phone numbers in the database as 123447775665554(input mask is used for input, and some numbers have extensions), and I also know from db if the number is Canadian, US, or some...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.