webMethods Business Console Documentation 10.5 | webMethods Business Console Documentation | Developing Gadgets for Business Console | Creating User Interface for Gadgets | Validating Fields in a Form
 
Validating Fields in a Form
You can use the bc-validate directive to validate fields in a form. To validate a field, add the bc-validate directive with one or more of the following options separated using commas.
Option
Description
non-empty
Mandatory
text
Text only
numeric
Numeric only
numeric-int
Numeric integer only
numeric-float
Numeric float only
alpha-numeric
Alpha-numeric only
email
Email address only
url
Web links only
port
Port numbers only
ip-address
IP address only
min-value
Minimum limit
max-value
Maximum limit
The field must be bound to an ng-model that is used for performing the validation. For example:
<input type="text" data-ng-model="binding_Attribute" bc-validate="non-empty,
numeric-int"/>
If you want to provide values dynamically at runtime without binding to a model, add the non-scoped attribute to the field. The non-scoped attribute checks the runtime value of the field instead of looking into a model. For example, use the non-scoped attribute when setting values using methods such as jQuery or others. For example:
<input type="text" id=”textID” bc-validate="non-empty,
non-scoped, numeric-int"/>
You must validate all fields in a form again if it has a Save button. To validate all fields when the Save button is clicked, define the Save button as shown in the following example:
<button type="button" id = "save-button" class="bc-button"
saveCallback="submitPage()" bc-validate="save">Save</button>
In this case, instead of calling ng-click="someFunction()", you must define it in saveCallBack. The validation framework automatically initiates the callback after the form is validated. Additionally, you must set bc-validate="save" in the Save button.

Copyright © 2014-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.