Skip to main content
Participant
April 21, 2007
Question

Form validation

  • April 21, 2007
  • 2 replies
  • 461 views
I would like to create a form validation that checks if the input of a certain field contains a number in a specific format. The format should be alphabetic(one character).numeric(two characters).numeric(three characters) ex. A.01.999

How can I achieve this with the form validation in DreamWeaver MX?

Thanks in advance!

Robin Meeuwsen
This topic has been closed for replies.

2 replies

Inspiring
April 22, 2007
Rmeeuwsen wrote:

> I would like to create a form validation that checks if the input of a certain
> field contains a number in a specific format. The format should be
> alphabetic(one character).numeric(two characters).numeric(three characters) ex.
> A.01.999
>
> How can I achieve this with the form validation in DreamWeaver MX?
>
> Thanks in advance!
>
> Robin Meeuwsen
>
function specialTest(inp){return /^[A-Z]\.\d\d\.\d\d\d$/i.test(inp);}

Let's assume the input is named "codeNumber"

<form ... onsubmit=
"MM_validateForm(...);
return document.MM_returnValue" &&
specialTest(this.codeNumber.value)">

Mick
RmeeuwsenAuthor
Participant
April 23, 2007
Thanks. I'm going to try this one out.
Günter_Schenk
Inspiring
April 21, 2007
Such a specific validation can be done by defining a "regular expression" pattern -- but DW MX built-in "Validate Form" behaviour regretfully doesn´t provide an "apply regular expression" option.

You might want to give some advanced 3rd party form validation extensions a try, some of them let you apply your own pattern (sometimes called "mask").