CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 Input Validation - How to display correct err msg?

Print topic Send  topic

Author Message
teufel
Posted: 09/11/2002, 10:36 AM

Hi,

I have an input text field in a record form. This field is either required
or not. The important thing is that it shall obey a specific mask (lets say
it is a ZIP code).

The file that has listed in it the regular expressions for predefined E-mail
and ZIP validations is located at:

Path_To_CodeChargeStudio\Components\TypeLib.xml

It has the following lines in it:

<List name="InputMasks">
<Item value="^[\w\.-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]+$"
name="EMail" />
<Item value="^\d{5}$" name="5-digits ZIP Code" />
</List>

So inside CCS I click over the text box, then at 'Properties' at the 'Data'
tab, and finally I select the drop-down box named 'Input Validation'. Two
values will be listed by default, namely 'EMail' and '5-digits ZIP Code'
(due to the entries in the XML file above).

TIP: if you input other regular expressions into this XML file and restart
CCS you will have new validation entries available to you.

Then I choose the option '5-digits ZIP Code', and the regular expression
'^\d{5}$' gets copied into the 'Input Validation' entry. Everything fine
until now.

Now my questions:

1) Now I publish the project and check for validity by entering a wrong ZIP
format at my form. I receive the following message:

Mask validation failed for field ZIP.

Looking at file
'Path_To_CodeChargeStudio\Components\Translations\Site\English.XML' I can
find the following line of code which corresponds to the message above

<Msg name="MaskValidation" value="Mask validation failed for field
{FieldName}." />

and I also find in the same XML file the following pre-defined lines of
code:

<Msg name="IncorrectEmailFormat" value="Invalid email format in field
{FieldName}." />
<Msg name="IncorrectPhoneFormat" value="Invalid phone number format in field
{FieldName}." />
<Msg name="IncorrectZipFormat" value="Invalid zip code format in field
{FieldName}." />

So if there are specific error messages for all of these three masks (Email,
Phone and Zip Code), why the hell do I receive a standard error message???

What am I missing here???

2) Which rules should I follow to make an entirely new automated validation
rule for my site (lets say a Social Security Number)? I believe I should do:

a) Create a new reg. expression inside file 'TypeLib.xml', such as

<Item value="^regular_expression_for_social_security_number_goes_here$"
name="Social Security Number" />

b) Edit the language file where the error messages are contained, e.g.
English.XML (although they seem not to function...), and add something like:

<Msg name="IncorrectSocialSecNumFormat" value="Invalid Social Security
Number format in field {FieldName}." />

c) And probably also create a new file regarding 'Social Security Numbers'
inside the directory

Path_to_CodeChargeStudio\Components\Actions\Server\Validation

By default I found there the following files:

Regular Expression Validation.xml
Validate Email.xml
Validate Maximum Length.xml
Validate Maximum Value.xml
Validate Minimum Length.xml
Validate Minimum Value.xml
Validate Phone.xml
Validate Required Value.xml
Validate Zip.xml

Are these files really used? Which rules should I follow to create a new XML
file here for validating my Social Sec. Num. (naming conventions, etc...)?

Please HELP!!!



   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.