Hi @exelexys
We already have an option for validate telephone number using pattern, but not for the email. At the moment, we validate the email only if it has @ and the domain.
If you want to add additional validation, there is a way. You can use custom script. This code below will prevent the button submit action and will continue the validation form setting and the submit after custom validation is complete.
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function(event) {
document.querySelector('.guten-your_button_id button.gutenverse-input-submit').addEventListener("click", function(e) {
e.preventDefault();
var customValidate = true;
// Your custom validation
if (customValidate) {
document.querySelector('.guten-form-builder.guten-your_form_id').dispatchEvent(new CustomEvent("submit", { cancelable: true }));
}
});
});
</script>
For the id, you can get it from the blocks.
https://prnt.sc/IC476gbVrNJE
https://prnt.sc/MlNBv9m6-9nA
You’re welcome exelexys. Let me know if you still have any questions.
Having trouble accessing the value of, in this case, the email address field using the event listener you provided.
Added class name join-email-address to the email field within the form, but on submit, the value of:
const email_address = document.getElementsByClassName("join-email-address")[0].value;
or
var email_address = document.getElementsByClassName("join-email-address")[0].value;
is undefined.
Any ideas?
Please try using this code
var email_address = document.querySelector(".join-email-address input").value;
Hi,
I haven’t heard you for a while. I will mark this as resolved. If you still have questions, please create another topic.
Thank you