//To validate an Australian phone number in Contact Form 7:
//Add Phone Field in CF7:
<div class="form-fields-wrapper">
<label>PHONE NUMBER <span>*</span></label>
[text* phone-number class:phone-number id:phone-number minlength:10 maxlength:10]
</div>
//Add jQuery Script in Footer:
<script>
jQuery(function($){
var phoneNumberField = $('#phone-number');
phoneNumberField.on('input', function() {
var currentValue = $(this).val().replace(/[^0-9]/g, '');
phoneNumberField.next('.phone-error').remove();
if (currentValue && !currentValue.startsWith('04')) {
phoneNumberField.after('<div class="phone-error" style="color: red;">Please enter a valid Australian number.</div>');
} else {
$(this).val(currentValue);
}
});
});
</script>
//Explanation: This script restricts input to numbers only and shows an error if the number doesn’t start with "04".
https://darshanvachhani12.wordpress.com/