• 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: Validate two fields in one custom validation

Validate two fields in one custom validation 6 years 9 months ago #37085

Hello,

I have created a multi-page form and in one step of the form, i would like to validate a serial number and a product id against a database. So I have created two custom validations the first one to check if the serial is available in the database and the second one to check if the product id is in the database. This is working fine.
But now i also want to check if the serial entered matches the product id the user entered. Is there a way to submit both fields at once to one validation? Or is there another way how i could achieve this?

Thank you in advance.
The administrator has disabled public write access.

Validate two fields in one custom validation 6 years 9 months ago #37086

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

If I understood this properly you should be able to use the "Multiple Rules" validation rule. Notice that when you select this for your field, a multi select is then available where you can choose, as suggested, multiple validation rules on your field (hold CTRL when making selections).

From these validation rules, you can also select the "Same Value as Other Field" validation rule. This will then show an extra field where you can add the exact name of your other field - case sensitive (note that it will suffice if you set the "Same as" validation rule for one single field as the other one will be already linked with it).
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.

Validate two fields in one custom validation 6 years 9 months ago #37087

Hi,

thank you for your reply. The multiple rules do not work in this case. There are two different values, the serial number and a product id. And one product id can have many different serial numbers. So i have to check, if the given serial number matches to the correct product id.
I solved it by accessing the product id directly in the customvalidation function with the $_POST variable. I just wondered if there might be a more elegant way to solve this.
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!