In the section Forms we learnt about the different Form types supported by Zoho Creator and the configurations that can be made to your Forms like, Setting Email Notifications, Creating Relationship, Configuring Form Actions and so on. All the Forms created in your application will be listed in the Dashboard. You can use the Application Settings -> Sections option to organize your Forms and Reports under different sections. To add records to your Form, access the application by selecting Access this application button.
A record is a row of data submitted through a Form. In the topic, Form Types we have learnt that Zoho Creator supports two types of Forms - Normal Forms and Stateless Forms. The data submitted through a Normal Form will be directly added to the relevant table in your database. In the screen-shot given below, a Sales record is entered in the Sales Form. On click of the Submit button, the Sales data will be updated in the Sales database. If Form action scripts are configured to validate data, the data will be updated only if validation is successful.
You can also add records to the Form by clicking the Add button in the report header, as shown in the screen-shot below. For shared users, the Add button will be displayed in a Report only if access permission is provided by the app owner, to add new records.
Selecting Settings Icon on the right will display the following options as shown in the screen-shot below:
1. Restrict entries to a form by everyone except the admin user
In the following code, Added_User stores the name of the user who added the current record and zoho.adminuser returns the name of the admin user. If the added user name is not equal to the admin user name, the record will not be added. The code is added on add ->validate block of the Script tab.
Zoho Creator automatically tracks details about when and by whom a record was added or modified using the fields Added User, Added Time, Modified User and Modified Time. This information will be displayed in the view, if the columns are selected from Column Properties option of the View tab in Edit mode. Refer the topic, Display User name and time, for more information.
2. Restrict entries to my Registration Form based on a given date
Assume you have a Registration form to register for a specific course and the registration is open till 30th Dec 2009. To restrict entries from being submitted after this date, use the zoho.currentdate variable within the on add ->on validate block of the Script tab, to validate if the registration date has expired. The sample code is given below.