ISAPLHA and ISDIGIT functions in Visual FoxPro 9

ISALPHA function is one of the powerful functions in Visual FoxPro 9 that can be used to test if the inputted data is a string or character. By default, ISALPHA has a false value and returns a true value when the Expression is a string data. It is very helpful in filtering illegal inputs:

Syntax:
ISALPHA(Expression)

Where;
1. Expression can be a variable, a text, or a control. ISAPLHA can be entered in any capitalization.

Examples:
ISALPHA(“John”)
ISALPHA(strname)
ISALPHA(Thisform.NameTextbox.Value)

To see ISALPHA in action, follow these steps:

1. Click Start>All Programs>Microsoft Visual FoxPro 9.0.
2. Click File>New>Form>New File.
3. Design your interface as follows:



4. Double-click the control named OkButton then enter the following codes:



5.Press F5 to test our sample application.

Another useful input validation function in Visual FoxPro 9.0 is the ISDIGIT function. It works like ISNUMERIC function in PHP wherein it allows you to test whether the input is a numeric data. Just like the ISALPHA function, the default value of is numeric function is false and it returns true whenever the contents of the expression is a numeric value.

Syntax:
IDIGIT (Expression)

Where;
1. Expression can be a variable, a number, or a control. ISDIGIT can be entered in any capitalization.

Examples:
ISDIGIT (“John”)
ISDIGIT (intage)
ISDIGIT (Thisform.AgeTextbox.Value)

The following example demonstrates the capability of ISDIGIT function:

1. Click Start>All Programs>Microsoft Visual FoxPro 9.0.
2. Click File>New>Form>New File.
3. Design your interface as follows:



4. Double-click the OkButton then enter the following:



5. Press F5 to test our sample application.

Those are the two powerful input validation functions in Visual FoxPro 9. Hope you learn something from it. Till next time.