Click to See Complete Forum and Search --> : Check textarea contains 8 numbers


noshankus
04-16-2003, 06:24 AM
Hello,

Nice place you guys got here! :)

I have a form that's written in Perl, but basically, I want the submit button disabled UNLESS in a certain text area, an 8 digit number has been written.

Any idea how I would go about doing such a thing??

Thank you for your help and hints!
Best regards,

noshankus
04-16-2003, 08:15 AM
Hi,

thanks for the reply.
I'm using a text area as follows:

<input type=text name="bug" size=80>

However, what you supplied didn't work unfortunately!
I didn't get any errors, or anything.

But thanks for trying. :D

Keep the ideas coming please ;)

DrDaMour
04-16-2003, 09:07 AM
that's a text box, not a text area they are very different things, and make sure you changed yourFieldName to bug.

havik
04-16-2003, 10:34 AM
This is a text area
<textarea>I'm a text area</textarea>

The other is a text box

So this is what you want to do:

<form name="enteryourformnamehere" onsubmit="
var fld = this.bug;
if (!/^\d{8}$/.test(fld.value)) {
alert("8-digit number required.");
fld.focus();
return false;
}
return true;">

Havik