Creating your own AJAX Form Validations
The AJAX checks you can associate with input fields are all stored in backend/controls/checks.
Once again, the best way to create a new check procedure is copying an already existing file and editing it. (The name of the new file MUST have the extension “.check.php”!) In this type of files, only three variables are important:
|
Variable |
Description |
|---|---|
|
$inputValue |
This is the string you have to evaluate. |
|
$c_return |
The result of the check. If the check succeeds, it has to be set to 1 at the end of the script, else to 0. |
|
$MESSAGE |
This error message is displayed in the interface if the check fails. |
Finally, to add a check file for selection in the “Member Permission” screen in Menu->”System Settings”->”System Groups”, execute the following SQL statement in the spunQ database:
spunq_db=> INSERT INTO control_check (control_check_title, control_check_source) VALUES ('[TITLE]', '[FILENAME_WITHOUT_.CHECK.PHP]') You can simply do this in an database management tool with graphical user interface such as phpMyAdmin or phpPgAdmin – depending on the database type you are using with spunQ. In both cases, you will have to log in to the system by providing a user with write permissions for the table control_check (being 'spunq_adm' per default). Additionally, you will of course have to modify the values in square brackets to fit the properties of your new check script.
In phpMyAdmin, choose the spunQ database from the drop down list on the left. Once you get the list of tables, choose “SQL” from the top menu and paste the command above there.
In phpPgAdmin, choose “SQL” from the menu at the left top of the screen. You will then get a popup window, where you just have to select your spunQ database in the corresponding drop down field and paste the command above into the main text area.
Tags
Technical, User Interface, AJAX, ConfigurationRelated Subjects
>> Controls>> System Groups
