473,545 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need a fresh set of eyes on a Javasript edit

15 New Member
Hello All, I'm getting frustrated with the syntax of a jscript edit I'm using on a VBScript page. Here is what I have:

var re = /[$\\@\\\#%\^\&\* \(\)\[\]\+\_\{\}\`\~\=\ |]/;
if (!re.test(docum ent.login.NewUs erPassword.valu e))
{
AlertMessage += "Invalid entry! You must also use nonalphanumeric characters!";
focusfield =document.login .NewUserPasswor d;
}

and when I run it I get "error: undefined is "null" or not an object"

Basically, it is a password reset page and one of the rules is that the new p-word has to have non-alphanumerics in it. I know it is something minor, but I have stared at it so long

Thanks in advance for your ideas!
Jun 26 '07 #1
5 1259
epots9
1,351 Recognized Expert Top Contributor
this is just a shot in the dark but maybe add quotes:
Expand|Select|Wrap|Line Numbers
  1. var re = "/[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/";
  2.  
and what is test? can u post its source?

good luck
Jun 26 '07 #2
JCCDEVEL
15 New Member
Thanks for your speedy reply! It is syntax I borrowed from a site that has lots of javascript examples. The specific one I borrowed from looked like this:

var re = /[$\\@\\\#%\^\&\* \(\)\[\]\+\_\{\}\`\~\=\ |]/
if (!re.test(str)) return false;

I thought that "test" was a function. I'm open to doing it another way, just thought that this looked pretty straightforward !

The funny things is I had this thing somewhat working on Friday, and now it doesn't work!
Jun 26 '07 #3
gits
5,390 Recognized Expert Moderator Expert
hi ...

yes ... test() is a build in js-method that may be used the following way:

Expand|Select|Wrap|Line Numbers
  1. // regEx that requires all chars as numeric
  2. var re = /^\d+$/; 
  3.  
  4. // this returns true
  5. re.test('111');
  6.  
  7. // this returns false
  8. re.test('111a');
  9.  
kind regards ...
Jun 26 '07 #4
gits
5,390 Recognized Expert Moderator Expert
... i tested your regEx ... it seems to be ok ... may be your value is not referenced correctly? is document.login. NewUserPassword defined in your page?

kind regards ...
Jun 26 '07 #5
JCCDEVEL
15 New Member
Thank you so much for your help. This what I ended up using:

if (!((document.lo gin.NewUserPass word.value.sear ch(/[a-z]+/) > -1) && (document.login .NewUserPasswor d.value.search(/[A-Z]+/) > -1) && (document.login .NewUserPasswor d.value.search(/[0-9]+/) > -1) && (document.login .NewUserPasswor d.value.search(/[^a-zA-Z0-9_]+/) > -1)))


and it is working well

Thanks for sharing your knowledge!
Jun 29 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1376
by: Bruce D | last post by:
Here's the breakdown: MySQL 4.0.12 Table: Assignment (indexes are created on proper fields) 419,234 records Table: Finders (indexes are created on proper fields) 5,345,657 records My user wants to be able to do a wild card search on lastname in the finders table. So, I wrote the following query. SELECT Finders.Lastname,...
11
1593
by: Laiverd.COM | last post by:
Hi, In the following function I keep getting a 'Object expected at line 75 char 5' but for the life of me I cannot find the error. Maybe someone would be so kin to have a look? I indicated the 'problem' line below in the function. function checkEmail(f){ // check for a valid emailadress var field = f; // alert(field.value); var str =...
5
1860
by: jensen bredal | last post by:
I need to keep track on user "session data" while still turning session off as i do not want users login to expire? Thanks JB
0
1591
by: shinichi | last post by:
Hi all, Im an Oracle newbie here. I have questions here that need guidance from Oracle Expert here. Here it goes: - there are 3 databases that will be used: tableA (2000 records), tableAsub (45000 records), and tableBsub (850000 records) - relationship between the 3 tables: "tableA" --link to--> "tableAsub" --link to--> "tableBsub" - get...
0
3924
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need Inbox Reply from Craig Somerford <uscos@2barter.net> hide details 10:25 pm (3 minutes ago)
20
4232
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black...
1
1962
by: bomahony | last post by:
Ive just installed DB2 9.1 from scratch on Solaris 10. I did it first from CLI, but i found the Control Center app was missing. So i tried to edit the install using db2setup. this informed me that everything was installed. so i uninstalled and then reinstalled using the db2setup gui, however db2cc is still missing!
2
1297
by: pbd22 | last post by:
Hi. I have been wrestling with a problem for over a week now and I think I need to breathe and rethink my approach. I am wondering if somebody wouldn't mind telling me how they would tackle the problem (rather than tell me why my code is failing)? The problem:
7
2890
by: ojsimon | last post by:
Hi I found this script on a forum and have been trying to make it work, but all it returns is a blank screen, i tried using the debug error reporting but got nothing from that either just a blank page, here is the code<?php //In this case, it fetches a search for "fresh content" from www.alltheweb.com, whom we hope you will visit....
0
7468
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7757
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.