4.7.9 The CustomValidator tag

Description

The « CustomValidator » validator is used to make a specific validation. In this case, a corresponding JavaScript function must be added to the control, and then its name must be specified as a value of clientvalidationfunction.

Example:

The following example shows how to create a validation defined in a JavaScript function called « fct_JS ».

Rendering

output_html_52b47f51.png


XHTML

settings


<bluage:CustomValidator id="phonenumber_format" forid="txt_phonenumber" errormessage="Please check the phone number field format" clientvalidationfunction="validatePhone()"/>

<bluage:Keep techno="all"><![CDATA[

<script>

function validatePhone() {

var phoneNumber =

document.getElementById("txt_phonenumber").value;

var regex =

new RegExp(/^(01|02|03|04|05|06|08)[0-9]{8}/gi);

var match = false;

return phoneNumber=="" || regex.test(phoneNumber);

}

</script>

]]>

</bluage:Keep>

Screen    activity    diagram

output_html_m48ba1b8f.png

Entities    Diagram

output_html_1ecdd945.png

Service    activity    diagramN/A

Tag attributes: reference

NameCustomValidator
DocumentationMakes a specific validation defined by the user
Diagram

output_html_3095cca9.png

Tag attributes description

AttributeRequiredDescription
IdYUnique tag ID in the page
foridYID of the item to be validated
errormessageNerror message to display in case of validation error
styleclassNError message to display style CSS class
clientvalidationfunctionYJavaScript function name

BLU AGE is a registered trademark of NETFECTIVE TECHNOLOGY S.A. - Trademarks are property of their respective owners
Do not copy or divulge without written permission