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

Login Form

1- You must create a new application of Control type and configure it as shown in the image below. ...

Contact Form

In this tutorial we will be preparing an application of the Control Form type in which the format w...

Registration Form

Registration Form 1- You must create a new application of the type Control and configure it as s...

Fields Digital Signature, Select2, Switch and Slider

This example demonstrates the form fields added in version 9.2 of Scriptcase: Digital Signature, Ra...

Comment this post