Alpha Video Training
Results 1 to 2 of 2

Thread: FormView Field Validation

  1. #1
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015

    Default FormView Field Validation

    Alpha Anywhere has always had a robust set of validation tools. This now includes the FormView control.

    Validation javascript

    Validation rules for fields in the FormView can be created using the "Validation javascript" property.


    "Validation javascript" is a function that will be called to validate the field in your FormView. The function is given the parameter 'v', which is the value in the field. If, for example, a field cannot be blank, you could compare the value of v against an empty string:

    if (v == "") {
         return "Field cannot be blank.";
    Validation for individual fields is executed whenever the field is changed using an Editor. In addition, the entire form is validated when a saving the form using the pre-defined "Save Form Edits/Cancel Edits" buttons. Validating before saving back to the data source will catch validation errors in any field in the form - even if the user has not modified it. All validation occurs client-side, allowing your app to function in a disconnected environment. No callbacks required!

    Error Styling

    Styling the field and error text can be done by specifying the class to use for the "Error" and "Error Text" properties. These properties can be found on the "Form Properties" tab in the Form View Builder.


    Classes can come from a style sheet or can be implemented on the CSS tab in the Form View Builder. In the image above, two classes were created to style errors - errorField and errorMsg. Their implementation is shown below:

    .errorField div {
         color: red;
    .errorMsg {
        display: block;
        color: red;
        padding: 5px;
        margin: 2px;
    The classes will be applied to a field and its corresponding error text when validation fails. In the image below, validation failed for the "Postal Code" field because the postal code cannot be blank and the errorField and errorMsg classes were both applied:


    Questions? Comments?

    Share your questions or comments here on the forum. Let us know how validation is working for you (or not working!) If you have suggestions for things you'd like to see or need more information to solve your particular problem, post them in the forum.

    Get the Component

    For the component used to create this post, download the zip file below.

    Note: The list control in this component uses a SQL connection string against the Northwinds database, which is included in your Alpha Anywhere installation. You will need to create or modify the connection string for the list to make it work.
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  2. #2
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Join Date
    Dec 2006

    Default Re: FormView Field Validation

    I have watched all the introductory videos. Thanks from them.

    In formview (and viewbox) Alpha seems to now adopted model-view-controller principles like others. Good start.

    Validation is important think. I hope when international customer types in field Älphå customer really gets Älphå and not Älphå and that validation really works with international characters.

    In other words you should make sure that these tablet optimized forms are utf-8 compatible and when you safe data to database it remains in utf-8 format.

Similar Threads

  1. Field validation javascript in Formview not firing if value is null/undefined
    By dougeven in forum Tablet-Optimized Form Capabilities Beta
    Replies: 6
    Last Post: 10-09-2015, 04:08 PM
  2. How to update the value of a dependent field in a Formview?
    By dougeven in forum Tablet-Optimized Form Capabilities Beta
    Replies: 1
    Last Post: 10-02-2015, 01:46 PM
  3. How to format date field in a formview
    By dougeven in forum Tablet-Optimized Form Capabilities Beta
    Replies: 2
    Last Post: 09-25-2015, 06:39 PM
  4. Mutiple row field validation using validation xbasic
    By Scott Emerick in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 06-22-2011, 02:22 PM
  5. Grid component field validation (date field)?
    By Hansolo in forum Web Application Server v7
    Replies: 4
    Last Post: 01-26-2006, 11:21 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts