Can someone please tell me how to alter this code if it needs altering, . thanks in advance.
1. The form keeps focusing on "username" and won't submit. The 2 username functions may be clashing? i want the username to be letters and numbers only , no special characters or spaces, 5-18 characters.
2. The country is a drop down list, and they must select one. I think since it is a drop down i don't need the function which checks for blanks and empty? or do i? or maybe it should be altered?
3. The opt15 function if for a mandatory checkbox,
4.. That the closing brackets at the end are correct?
The problems may well be very simple omissions, i'm not html literate. these are ASP pages by the way. -
if (String(frm.username.value).replace(/ /g, "") == "") {
-
alert("Please enter desired username. Must be between 5-25 characters (no special characters).")
-
document.frm.username.focus() ;
-
return false; }
-
-
var regExp = /^[A-Za-z][A-Za-z0-9_]*$/;
-
if(!regExp.test(frm.username.value))
-
alert("no special characters or spaces in 'username'")
-
if(frm.username.value.length > 18 || frm.username.value.length < 5)
-
alert("'Username' should be between 5-18 characters.")
-
for(i=0;i<frm.username.value.length;i++) {
-
document.frm.username.focus() ;
-
return false; }
-
-
-
if (String(frm.country.value).replace(/ /g, "") == "") {
-
alert("Please enter your country.")
-
document.frm.country.focus() ;
-
return false; }
-
-
if(document.frm.country.value.length < 2) {
-
alert("Minimum 2 characters for 'country'.")
-
document.frm.country.focus() ;
-
return false; }
-
-
if(document.frm.country.value.length > 20) {
-
alert("Maximum 20 characters allowed for 'country'.")
-
document.frm.country.focus() ;
-
return false; }
-
-
var mycheckbox = document.frm.opt15;
-
if (mycheckbox.checked == false) {
-
alert("this checkbox is mandatory")
-
return false;
-
}
-
return true;
-
}
-
}
2 1597
first problem -
if(frm.username.value.length > 18 || frm.username.value.length < 5)
-
alert("'Username' should be between 5-18 characters.")
-
for(i=0;i<frm.username.value.length;i++) {
-
document.frm.username.focus() ;
-
return false; }
-
-
-
if(frm.username.value.length > 18 || frm.username.value.length < 5) {
-
alert("'Username' should be between 5-18 characters.")
-
document.frm.username.focus() ;
-
return false; }
-
thank you, IamClint. appreciated.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: chrisdude911 |
last post by:
how do i add video into a javascript web page with my own custom
buttons?
|
by: shapper |
last post by:
Hello,
I would like to use a javascript library to simplify my coding
process.
I know a few: JQuery, Dojo, Yahoo UI, ...
Which one do you advice me to use?
Thanks,
Miguel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| | |