Re: .length is always 1
- From: Jorge <jorge@xxxxxxxxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 06:35:59 -0700 (PDT)
On Jul 31, 3:15 pm, maxwe...@xxxxxxxxx wrote:
For the record - the working JavaScript validator for WikiName format:
function checkup(theform){
var form = document.forms[theform];
var okay = true;
if (form.name.value.match(/[A-Z][a-z0-9]*[0-9A-Z]/)) {
wikiName = form.name.value.match(/[A-Z][a-z0-9]*[0-9A-
Z]/).toString();
if (wikiName.length<3) {
alert(form.name.value + ' is not a WikiName - please use one word
with at least two capital letters');
okay = false;
}
}
You could as well use (array)[0], as GArlington pointed out, instead
of (array).toString().
That's probably more correct :
wikiName = form.name.value.match(/[A-Z][a-z0-9]*[0-9A-Z]/)[0];
--Jorge.
.
- References:
- .length is always 1
- From: maxwells
- Re: .length is always 1
- From: GArlington
- Re: .length is always 1
- From: maxwells
- Re: .length is always 1
- From: maxwells
- .length is always 1
- Prev by Date: Re: Refreshing the parent page from the SECOND child
- Next by Date: Re: Getting rid of eval for accesing "deep" properties
- Previous by thread: Re: .length is always 1
- Next by thread: isElement - determining if an object is an element
- Index(es):