Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( typeof(alert_message_phone) == 'undefined' ) { var alert_message_phone = 'Please enter a valid phone number. Most US/Canada and International formats accepted.'; }
- jQuery(document).ready(function (a) {
- a("#sendmail").attr('disabled', false);
- a(".wp2pgpmail").each(function () {
- a(this).validate({
- rules: {
- "wp2pgpmail-secret": {
- required: true,
- digits: true,
- maxlength: 2
- }
- },
- errorPlacement: function (a, b) {
- if (b.is(":radio") || b.is(":checkbox")) {
- a.appendTo(b.parent().parent())
- } else {
- a.insertAfter(b)
- }
- },
- submitHandler: function(form) {
- var message = '';
- var label = '';
- for(i=0; i<form.elements.length; i++){
- champ = form.elements[i];
- label = form.elements[i].name;
- if (typeof label != "undefined"
- && label != ""
- && label != 'form_id'
- && label != '_wpnonce'
- && label != 'wp2pgpmail-secret'
- && label != 'wp2pgpmail-spam'
- && label != 'wp2pgpmail-submit'
- // Insert Email and Name field names here:
- && label != 'wp2pgpmail-email-10'
- && label != 'wp2pgpmail-name-11'
- && (
- champ.type == 'text'
- || champ.type == 'textarea'
- || (
- champ.type == 'checkbox'
- && champ.checked == true
- )
- || champ.type == 'select-one'
- || (
- champ.type == 'radio'
- && champ.checked == true
- )
- )
- ) {
- message += champ.value + "\r\n";
- champ.value = '-- encrypted data --';
- if ( champ.value != '-- encrypted data --' ) {
- champ.options[0] = new Option("-- encrypted data --", "-- encrypted data --", false, false);
- champ.value = '-- encrypted data --';
- }
- }
- }
- message += "\r\n[" + form._ip.value + "]\r\n";
- form._message.value = message;
- if ( encrypt() ) {
- form.submit();
- }
- }
- })
- });
- a.validator.addMethod("phone", function (a, b) {
- a = a.replace(/[\+\s\(\)\.\-\ ]/g, "");
- return this.optional(b) || a.length > 9 && a.match(/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/)
- }, alert_message_phone);
- a(".wp2pgpmail-date-picker").datepicker({
- minDate: "-70y",
- changeMonth: true,
- changeYear: true,
- maxDate: "+10Y +1M +10D",
- yearRange: "c-100:c+20",
- firstDay: 1
- });
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement