Thanks for reaching out to us. This would require a custom validation script. Here is the one that you can use
<script>
window.ameliaActions = {
customValidation: function (success = null, error = null, data) {
console.log('customValidation HOOK')
console.log('------------')
console.log(data)
const customValidator = (rule, value, callback) => {
let pattern = /^\d{10}$/;
if (!pattern.test(value.replace(/\D/g,''))) {
callback(new Error())
} else {
callback()
}
}
data.rules.phone.push({required: false, message: 'The phone number must be 8 digits long', validator: customValidator, trigger: 'submit'})
}
}
</script>
Custom code needs to be applied to the page where the booking form is. Depending on what you're using (Gutenberg blocks, or some page builder), adding the CSS or JS can be done in a few different ways.
If you need help with adding custom CSS to the page, please take a look at this article.
If you need help with adding custom JS to the page, please take a look at this article.
I need to set up a custom field and add it to the booking form, specifically for the customer's ID (DNI) (text) field. This field needs to have specific requirements: it should have a maximum character limit 10, and it also needs a specific validator to ensure the correct format.
Could you guide me in configuring these specifications for the custom field?
I would kindly ask you to open a new ticket and we will provide assistance there. In that way, issues and questions that are related to different subjects will be in separate tickets so other customers or our support agents can find them easily.
Could we add a rule to ensure that the phone number is definitely 10 digits long, to avoid any mistakes?
Hi Dimitris,
Thanks for reaching out to us. This would require a custom validation script. Here is the one that you can use
Custom code needs to be applied to the page where the booking form is. Depending on what you're using (Gutenberg blocks, or some page builder), adding the CSS or JS can be done in a few different ways.
If you need help with adding custom CSS to the page, please take a look at this article.
If you need help with adding custom JS to the page, please take a look at this article.
Kind Regards,
Stefan Petrov
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello there,
I need to set up a custom field and add it to the booking form, specifically for the customer's ID (DNI) (text) field. This field needs to have specific requirements: it should have a maximum character limit 10, and it also needs a specific validator to ensure the correct format.
Could you guide me in configuring these specifications for the custom field?
Hello Rakinul,
I would kindly ask you to open a new ticket and we will provide assistance there. In that way, issues and questions that are related to different subjects will be in separate tickets so other customers or our support agents can find them easily.
Thank you for understanding.
Kind Regards,
Stefan Petrov
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables