Tutorial: Data entry using masks

This example covers the use of forms with masks for data entry and how to validate social security number using ajax.

Creating a new form

1. Create a new form application using the table Employees.

2. On the menu application click in Fields Positioning.

3. Choose the fields: EmployeeID, FirstName, Title, BirthDate, SSN and HomePhone.

Adding masks to SSN e HomePhone

4. Open the folder Fields on the menu and click in the field SSN.

5. At the attribute Grid Mask add the mask: ###-##-####

6. Save and now click in the fields HomePhone.

7. At the attribute Grid Mask add the mask: (###) ### – ####;###-####

You can use semicolon to add more masks to the same field.

8. Open the folder Layout on the menu and click in Blocks.

9. Change the Label to Add/Edit Employees, check Display Label e and change Label Position to Above.

Creating a method to validate the Social Security Number

10. Open the folder Programming on the menu and click on Libraries.

11. Open the tab ScriptCase Libraries and check the library sc_ssn.php.

12. Now open the folder Methods on the menu and click in New Method.

13. Enter Name in ValidateSSN and click in Create.

14. Copy the code below to the field created in the step above (13):

if({SSN} != ''){
$oSSN = new scSSN();
if (!$oSSN->validateSSN({SSN})) {
sc_error_message("Invalid SSN");

Creating and Ajax event to the field SSN

15. Open the folder Ajax Events on the menu and click in New Ajax Events

16. Set up the event like the image below:

17. Add the following code to the event created:

Tutorials in the same category

Form with special fields

In this example, we'll see how to configure a couple of Scriptcase special fields, in a form applica...

Master-Detail (Single-to-Single)

In this example, a Master / Detail complete application, where we get an edit form of categories and...

Generate PDF from Forms

In this example we will see how to configure the application form to display the button to print the...

Form Mobile

Scriptcase Form applications are generated with mobile responsiveness automatically. Selectin...

Comment this post