Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Form validation

New Here ,
Apr 21, 2007 Apr 21, 2007
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
TOPICS
Server side applications
479
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 21, 2007 Apr 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").
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 21, 2007 Apr 21, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 23, 2007 Apr 23, 2007
Thanks. I'm going to try this one out.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 02, 2007 May 02, 2007
LATEST
Rmeeuwsen wrote:

> Thanks. I'm going to try this one out.

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

There was a typo in previous post.
Mick
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines