Thank you.
]]>document.addEventListener('DOMContentLoaded', function () {
// Allowed zip codes
var allowedZipCodes = [
'00000'
];
var zipCodeField = document.getElementById('nFormZipCode');
var nextButton = document.getElementById('nextButtonId');
if (zipCodeField && nextButton) {
zipCodeField.addEventListener('input', function () {
var zipCode = zipCodeField.value.trim();
if (allowedZipCodes.includes(zipCode)) {
zipCodeField.setCustomValidity(''); // Valid input
nextButton.disabled = false; // Enable Next button
} else {
zipCodeField.setCustomValidity('Invalid zip code.'); // Generic invalid input message
nextButton.disabled = true; // Disable Next button
}
});
// Initially disable the next button
nextButton.disabled = true;
}
});
I can’t find a place to insert this without the form validation at form submit. Is there a way to have validation on the “next” button?
]]>Paypal Express checkout is enabled on the checkout page.
How I can insert a checkbox before the Paypal button?
You probably know: It’s a necessary validation field. The customer has to tick that checkbox to show that he/she has read the terms and conditions.
]]>For “Checkout page Button Placement”: I chose: “In payment gateway section” . I don’t use the “Place Order Button”.
My question:
In the checkout page, if the customer selects Paypal as his preferred payment method, in my country it is necessary that the customer ticks a box first to prove that he has read the terms and conditions before the Paypal window opens. How I can implement that field (box). I need the complete code (addfilter + and how to show that box with text before the Paypal button)
]]>Is there a possibility to change the placement of this validation notice, preferably on or near the field(s) it concerns?
]]>I want to have phone number validation on my check out form. I notice that if someone for example puts letters in the phone field there will be a message saying to put a valid number. But it doesnt seem to flag it as wrong if the number doesnt have enough digits (10 for my country numbers) How can i have this kind of validation?
]]>When attempting to make a payment and required fields in the billing and shipping information are missing, clicking on the payment buttons simply scrolls me to the address section instead of receiving an error message indicating the missing fields.
I’ve checked the plugin settings and haven’t found an option to enable field validation before proceeding to payment. I’ve also compared this behavior with another PayPal plugin I used before, and that plugin correctly displayed error messages when fields were missing.
To reproduce the issue:
function verify_id_number($id_number, $gender = '', $foreigner = 0) {
$validated = false;
if (is_numeric($id_number) && strlen($id_number) === 13) {
$errors = false;
$num_array = str_split($id_number);
$id_month = $num_array[2] . $num_array[3];
$id_day = $num_array[4] . $num_array[5];
if ($id_month < 1 || $id_month > 12) {
$errors = true;
}
if ($id_day < 1 || $id_day > 31) {
$errors = true;
}
$id_gender = $num_array[6] >= 5 ? 'male' : 'female';
if ($gender && strtolower($gender) !== $id_gender) {
$errors = true;
}
$id_foreigner = $num_array[10];
if (( $foreigner || $id_foreigner ) && (int)$foreigner !== (int)$id_foreigner) {
$errors = true;
}
$even_digits = array();
$odd_digits = array();
foreach ($num_array as $index => $digit) {
if ($index === 0 || $index % 2 === 0) {
$odd_digits[] = $digit;
} else {
$even_digits[] = $digit;
}
}
$check_digit = array_pop($odd_digits);
$added_odds = array_sum($odd_digits);
$concatenated_evens = implode('', $even_digits);
$evensx2 = $concatenated_evens * 2;
$added_evens = array_sum(str_split($evensx2));
$sum = $added_odds + $added_evens;
$last_digit = substr($sum, -1);
$verify_check_digit = (10 - (int)$last_digit) % 10;
if ((int)$verify_check_digit !== (int)$check_digit) {
$errors = true;
}
if (!$errors) {
$validated = true;
}
}
return $validated;
}
add_action('um_submit_form_errors_hook', 'my_custom_validate_id_number', 10, 1);
function my_custom_validate_id_number($post) {
// Assuming 'drivers_id_number' is the key of your field in the form
$id_number = isset($post['drivers_id_number']) ? $post['drivers_id_number'] : '';
// Perform your validation (calling a hypothetical validate_id_number function)
if (!empty($id_number) && !validate_id_number($id_number)) {
UM()->form()->add_error('drivers_id_number', 'Invalid ID Number');
}
}
Please help me to debug this code,
What I need to achieve is to validate the ID number entered in UM form field. If it passes the form should be normally submitted, else display the error
When I edit a USER on the standard WordPress User admin page, upon saving changes, the error pops up preventing the record form being saved. If I change the User Display Name I can then save the changes. The program is failing on validation by checking its own record for duplicates. Once the record is saved, I can go back in and change the Display Name back to the original name without problems. I just can not edit a user and save the record without changing the Display Name.
]]>It was working fine but I’ve had a problem for a couple of weeks.
When I don’t fill any field and try to validate my form I got a warning message on the first field of the second column (Donner un titre à votre REX) -> usually I woud get a warning message on the first field of the firts column
When I fill all the fields of the second column and try to validate I got this screen :
Thanks in advance for your help
]]>