This topic is locked

Guide 27 - Custom AJAX validations

10/30/2021 5:19:40 PM
PHPRunner Tips and Tricks
fhumanes author

img alt
We are used to that Phprunner makes some validations using AJAX (asynchronous communication), for example to validate that a field is not duplicated, but it is not clear how to add this type of custom validations when the user is filling out a data form.

In the technology jargon, it is indicated that communication is desired by AJAX between the browser and the application server.

This type of communications can be used to validate a data or retrieve a server information starting from the information already informed in the form.

Objective

Describe in a simple and clear way how to make Ajax communications (between browser and application server) for validity and/or retrieve data

DEMO: https://fhumanes.com/guia27/

img alt
The example is very, very simple. In the "Valor" field you have to enter a number and validity that is the immediate superior to the values in the database.

  • If it is correct, it informs that it is correct.
  • If it is incorrect, it indicates that it is incorrect and in the field it puts the value that is correct.

This problem is resolved by programming the part of the browser in JavaScript and the server part in PHP.

If you are interested in the subject you can continue reading and download the project on my portal