PageSourceSearch

https://www.mbeachclubphuket.com/wp-content/themes/mBeachClubTheme/customforms/inc/js/form-scripts.js

js mbeachclubphuket.com collected 2026-10-04 10:34:13 UTC 5,855 bytes, 158 lines download raw bytes

1$(document).ready(function(){
2    $(".msg-status-row .alert").hide();
3    $(".response-field-captcha small.help-block").hide();
4
5    $("#contact-us").bootstrapValidator({
6
7        message: "This value is not valid",
8        excluded: [":disabled"],
9        
10        fields: {
11            first_name: {
12                group: ".response-field-text",
13                validators: {
14                    notEmpty: {
15                        message: "First name is required and cannot be empty"
16                    }
17                }
18            },user_email: {
19                group: ".response-field-email",
20                validators: {
21                    notEmpty: {
22                        message: "Email is required and cannot be empty"
23                    },
24                    emailAddress: {
25                        message: "Value is not a valid email address"
26                    }
27                }
28            },contactno: {
29                group: ".response-field-text",
30                validators: {
31                    notEmpty: {
32                        message: "Contact Number is required and cannot be empty"
33                    }
34                }
35            },country: {
36                group: ".response-field-dropdown",
37                validators: {
38                    notEmpty: {
39                        message: "Country is required and cannot be empty"
40                    }
41                }
42            }
43        }
44
45    }).on("success.form.bv", function(e) {
46        // Prevent form submission
47        e.preventDefault();
48        var googleResponse = grecaptcha.getResponse();
49        if (!googleResponse) {
50            $(".response-field-captcha small.help-block").html("The captcha is required and cannot be empty").show();
51        } else {
52            $(this).unbind( e );
53            $("#validateBtn").prop("disabled", false);
54            $(".msg-status-row .alert").show().html("<strong>Successfully Validated!</strong> Please wait while processing your request.").removeClass("alert-danger").removeClass("alert-info").addClass("alert-success");
55            $(".msg-status-row .alert").slideDown();
56            $("#contact-us").submit();
57            return false;
58        }
59
60    });
61
62    $("#resetBtn").click(function() {
63        $("#contact-us").data("bootstrapValidator").resetForm(true);
64        $(".form-control ").attr('value', '');
65        grecaptcha.reset();
66    });
67
68     $("#newsletter").bootstrapValidator({
69
70        message: "This value is not valid",
71        excluded: [":disabled"],
72        fields: {
73            title: {
74                group: ".response-field-dropdown",
75                validators: {
76                    notEmpty: {
77                        message: "Title is required"
78                    }
79                }
80            },first_name: {
81                group: ".response-field-text",
82                validators: {
83                    notEmpty: {
84                        message: "First name is required and cannot be empty"
85                    }
86                }
87            },last_name: {
88                group: ".response-field-text",
89                validators: {
90                    notEmpty: {
91                        message: "Last name is required and cannot be empty"
92                    }
93                }
94            },email: {
95                group: ".response-field-email",
96                validators: {
97                    notEmpty: {
98                        message: "Email is required and cannot be empty"
99                    },
100                    emailAddress: {
101                        message: "Value is not a valid email address"
102                    }
103                }
104            },
105        }
106
107    })
108    .on("success.form.bv", function(e) {
109        // Prevent form submission
110        e.preventDefault();
111        var googleResponse = grecaptcha.getResponse();
112
113        if (!googleResponse) {
114            $(".response-field-captcha small.help-block").html("The captcha is required and cannot be empty").show();
115        } else {
116      //    $('#email_news').on('blur', function(){
117            //  console.log('blue');
118            // });
119            var email_val = $('#email_news').val();
120            data = {
121                action: 'validate_newsletter',
122                value : email_val
123            };
124            $.post( ajaxurl, data, function( response ) {
125                if( response ) {
126                    if(response == 1){
127                        $('.help-block-subsc').html('Email Address is already subscribed').fadeIn();
128                        $('#email_subs_parent').removeClass('has-success').addClass('has-error');
129                    }else{ 
130                        $('.help-block-subsc').fadeOut();
131                        $('#email_subs_parent').removeClass('has-error').addClass('has-success');
132                        $("#validateBtn").prop("disabled", false);
133                        $(".msg-status-row .alert").show().html("<strong>Successfully Validated!</strong> Please wait while processing your request.").removeClass("alert-danger").removeClass("alert-info").addClass("alert-success");
134                        $(".msg-status-row .alert").slideDown();
135                        $('#newsletter').submit();
136                        $(this).unbind( e );
137                        return false;
138                    }
139                } else {
140                    $('.help-block-subsc').html('Try again latter').fadeIn().delay(5000).fadeOut();
141                }
142            });
143        
144        }
145
146    });
147
148     $("#email_news").keyup(function() {
149        $(this).parent().removeClass('has-error');
150        $('.help-block-subsc').fadeOut();
151    });
152
153    $("#resetBtnNew").click(function() {
154        $("#newsletter").data("bootstrapValidator").resetForm(true);
155        $(".form-control ").attr('value', '');
156        grecaptcha.reset();
157    });
158});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.