PageSourceSearch

https://www.cyprusprofile.com/plugins/renatio/formbuilder/assets/js/form.js

js cyprusprofile.com collected 2026-10-02 04:38:54 UTC 1,745 bytes, 69 lines download raw bytes

1/*
2 * Update states options when country is selected
3 */
4function updateStateDropdown(data) {
5    var states = JSON.parse(data.result);
6
7    var stateSelect = $('#country-state select');
8
9    if (stateSelect.length) {
10        var emptyOption = stateSelect.find('option:first');
11
12        stateSelect.html('');
13
14        for (var stateId in states) {
15            stateSelect.append('<option value="' + stateId + '">' + states[stateId] + '</option>');
16        }
17
18        stateSelect.prepend(emptyOption[0].outerHTML);
19    }
20}
21
22/*
23 * Implement nice invalid form fields
24 */
25$(window).on('ajaxInvalidField', function (event, fieldElement, fieldName, errorMsg, isFirst) {
26    var $field = $(fieldElement).closest('.form-group'),
27        $help = $('<p />').addClass('help-block');
28
29    if (!$field.length) {
30        return;
31    }
32
33    event.preventDefault();
34
35    if (errorMsg) {
36        $help.text(errorMsg.join(', '));
37    }
38
39    $help.addClass('form-field-error-label');
40    $field.addClass('has-error');
41
42    // Prevent the next error alert only once
43    $(window).one('ajaxErrorMessage', function (event) {
44        event.preventDefault();
45    });
46
47    if ($('.form-field-error-label', $field).length > 0)
48        return;
49
50    $field.append($help);
51
52    // Scroll to the form group
53    if (isFirst) {
54        $('html, body').animate({scrollTop: $field.offset().top - 100}, 500, function () {
55            fieldElement.focus();
56        });
57    }
58});
59
60$(document).on('ajaxPromise', '[data-request]', function () {
61    var $form = $(this).closest('form'),
62        $help = $('.form-field-error-label', $form);
63
64    if (!$form.length || !$help.length)
65        return;
66
67    $help.remove();
68    $('.form-group.has-error', $form).removeClass('has-error');
69});

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.