How can I define a custom validation rule ?
- Andrea
-
Topic Author
- Offline
- Elite Member
-
Less
More
9 years 1 day ago #80797
by Andrea
Visit my page! www.elementotango.it
How can I define a custom validation rule ? was created by Andrea
Hello there.
I wanted to use in my subscription form, a custom field, say a text one. This field needs to use a special validation rule to check its contents. I found on the internet the php script that executes the validation, and if the validation fails, produces an error message. Now I wonder how can I use all of this, i.e. create a custom text field that get validated by my own php script ?
Thanks in advance for the help!
Regards Andrea.
I wanted to use in my subscription form, a custom field, say a text one. This field needs to use a special validation rule to check its contents. I found on the internet the php script that executes the validation, and if the validation fails, produces an error message. Now I wonder how can I use all of this, i.e. create a custom text field that get validated by my own php script ?
Thanks in advance for the help!
Regards Andrea.
Visit my page! www.elementotango.it
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
9 years 1 day ago #80801
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic How can I define a custom validation rule ?
Hi Andrea
You will need to:
1. Go to Events Booking -> Custom Fields, add a new text custom field
2. Then look at the file components/com_eventbooking/controller/register.php, method validateFormData to add the custom PHP code you want to perform the validation
(You will need have good Joomla / PHP programming skill) to integrate this custom validation
Tuan
You will need to:
1. Go to Events Booking -> Custom Fields, add a new text custom field
2. Then look at the file components/com_eventbooking/controller/register.php, method validateFormData to add the custom PHP code you want to perform the validation
(You will need have good Joomla / PHP programming skill) to integrate this custom validation
Tuan
Please Log in or Create an account to join the conversation.
- Andrea
-
Topic Author
- Offline
- Elite Member
-
9 years 1 day ago #80812
by Andrea
Visit my page! www.elementotango.it
Replied by Andrea on topic How can I define a custom validation rule ?
Hi Tuan, now you scared me 
I'm not at all a good php programmer. I'm indeed not a php programmer. What I found on the internet, is the php script that does exactly what I need, that is I pass to this scripyt the string, and the output of the function is an error if the validation is not OK. I tried this into another event booking component
I used until now and it worked well.
Now I switched to your component which has some features that the other did not have, so I would like to use the same validation rule in it.
I will start following your advices here and plug in my php script. Do you have somewhere an example of a custom validation rule inserted into the file you mentioned, so I can try and understand what the php function is expected to give as results/output for example and so on ? This would be a starting point for me.
Thanks!!
Ciao Andrea.

I'm not at all a good php programmer. I'm indeed not a php programmer. What I found on the internet, is the php script that does exactly what I need, that is I pass to this scripyt the string, and the output of the function is an error if the validation is not OK. I tried this into another event booking component

Now I switched to your component which has some features that the other did not have, so I would like to use the same validation rule in it.
I will start following your advices here and plug in my php script. Do you have somewhere an example of a custom validation rule inserted into the file you mentioned, so I can try and understand what the php function is expected to give as results/output for example and so on ? This would be a starting point for me.
Thanks!!
Ciao Andrea.
Visit my page! www.elementotango.it
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
9 years 1 day ago #80813
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic How can I define a custom validation rule ?
Now you scared me, too
. Could you please attach the script you want to use here so that I can look at it to see whether it could be easy integrated into Events Booking so that I can try to see whether we could help you?
Tuan

Tuan
Please Log in or Create an account to join the conversation.
- Andrea
-
Topic Author
- Offline
- Elite Member
-
9 years 1 day ago - 9 years 1 day ago #80816
by Andrea
LOL! Well, they said on the forum that you're very available and flexible and I must admit you are. Thank-you for your offer to help!
Attached is the script. Apart the inclusion into the official validation rules that you see in the file, you will then find 2 functions. Both return true if the validation is passed, or return false if the validation is not passed.
Again many thanks for offering your help!
Regards Andrea.
Visit my page! www.elementotango.it
Replied by Andrea on topic How can I define a custom validation rule ?
LOL! Well, they said on the forum that you're very available and flexible and I must admit you are. Thank-you for your offer to help!
Attached is the script. Apart the inclusion into the official validation rules that you see in the file, you will then find 2 functions. Both return true if the validation is passed, or return false if the validation is not passed.
Again many thanks for offering your help!
Regards Andrea.
Visit my page! www.elementotango.it
Attachments:
Last edit: 9 years 1 day ago by Andrea. Reason: attached the file now :)
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.