• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Execution order of PHP Script and validations

Execution order of PHP Script and validations 9 years 9 months ago #31959

Hi there,

I'm putting together a form via RSForm Pro for users to submit a K2 article form the front end. I got the article creation working fine but now I need to add the validations to the form.

My question is about the execution order of the RSForm Pro php validations and the PHP script called on form process.

The reason I ask is because I am adding the K2 article to the K2 database via a PHP script called on form process and I want to make sure that validations are fine before I add the article to the database. The reason I do the database load on form process stage and I don't use the RSForm SQL mappings feature is because after loading the data in the database I need to trigger the K2 “onAfterK2Save” plugin event (this I got working fine).

I can see in the RSForm Pro documentation that it is possible to invalidate fields at the on form process stage, so I would like to understand the order of execution of the following:
a) PHP Script on form process
b) RSForm PRO standard PHP validation

Please correct me if I'm wrong, but I the behaviour I have been able to observe is:

Case A – AJAX validation disabled: first executes the PHP Script on form process and then executes the RSForm Pro validation.

Case B – AJAX validation enabled: first executes the RSForm Pro validation and then executes the PHP Script on form process.

Is this correct?

If I switch on AJAX validation, can I still invalidate a field on the PHP Script on form process stage as per your documentation? (
$invalid[]=RSFormProHelper::getComponentId("Other");
)

To avoid loading the database on the PHP Script when not all validations are OK would it be enough to see if the
$invalid[]
array is empty?

Many thanks!!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!