Plugin Directory

Changeset 3461790


Ignore:
Timestamp:
02/15/2026 12:01:02 PM (7 weeks ago)
Author:
pokhar
Message:

Release Version 1.4.9

Location:
whistleblowing-system/trunk
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • whistleblowing-system/trunk/Apps/defaultForms.php

    r3404400 r3461790  
    1616        $countriesOptions = '';
    1717        foreach ( WBLSLibrary::$country_list as $country ) {
    18             $countriesOptions .= '<option value="' . $country . '"' . $country . '</option>';
     18            $countriesOptions .= '<option value="' . $country . '">' . $country . '</option>';
    1919        }
    2020
  • whistleblowing-system/trunk/admin/assets/css/edit.css

    r3451009 r3461790  
    12681268}
    12691269
     1270.wbls-field-item[data-type="slider"] {
     1271    background-image: url(../images/fields_icons/sliders.svg);
     1272    background-size: 16px;
     1273    background-repeat: no-repeat;
     1274    background-position: left 10px center;
     1275    background-color: #0d9ad6;
     1276}
     1277
     1278.wbls-field-item[data-type="slider"].wbls-pro-tooltip {
     1279    background-image: url(../images/fields_icons/sliders.svg), url(../images/pro-icon.svg);
     1280    background-size: 16px, 30px;
     1281    background-repeat: no-repeat;
     1282    background-position: left 10px center, right 10px center;
     1283    background-color: #0d9ad6;
     1284}
     1285
    12701286.wbls-field-item[data-type="page_break"] {
    12711287    background-image: url(../images/fields_icons/page-break.svg);
     
    23512367}
    23522368
     2369/* Slider field styles */
     2370.wbls-slider-container {
     2371    width: 100%;
     2372    box-sizing: border-box;
     2373    display: block;
     2374}
     2375
     2376.wbls-slider-input {
     2377    width: 100%;
     2378    height: 6px;
     2379    -webkit-appearance: none;
     2380    appearance: none;
     2381    background: #ddd;
     2382    border-radius: 3px;
     2383    outline: none;
     2384}
     2385
     2386.wbls-slider-input::-webkit-slider-thumb {
     2387    -webkit-appearance: none;
     2388    appearance: none;
     2389    width: 20px;
     2390    height: 20px;
     2391    border-radius: 50%;
     2392    background: #000000;
     2393    cursor: pointer;
     2394    border: 2px solid #fff;
     2395    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
     2396}
     2397
     2398.wbls-slider-input::-moz-range-thumb {
     2399    width: 20px;
     2400    height: 20px;
     2401    border-radius: 50%;
     2402    background: #000000;
     2403    cursor: pointer;
     2404    border: 2px solid #fff;
     2405    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
     2406}
     2407
     2408.wbls-slider-meta {
     2409    display: flex;
     2410    justify-content: space-between;
     2411    margin-top: 8px;
     2412    font-size: 14px;
     2413    color: #666;
     2414}
     2415
     2416.wbls-slider-value {
     2417    font-weight: bold;
     2418    color: #000000;
     2419}
     2420
  • whistleblowing-system/trunk/admin/assets/js/edit.js

    r3451009 r3461790  
    1010            this.reset_field_options_new_keys();
    1111        }
     12
     13        // Initialize option handler
     14        this.optionHandler = new WBLS_OptionHandler(this);
     15
    1216        this.set_field_actions();
    1317        if( !wbls_edit.fieldNameLastId ) {
     
    117121            let current_option = jQuery(this).attr("data-option");
    118122            let val = jQuery(this).val();
    119             self.fields_options[self.edit_field_id][current_option] = val;
    120 
    121             switch (current_option) {
    122                 case 'label':
    123                     if (self.fields_options[self.edit_field_id]['type'] == 'submit') {
    124                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-submit-form").text(val);
    125                     } else {
    126                         if (self.fields_options[self.edit_field_id]['required'] === "1") {
    127                             jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text(val + "*");
    128                         } else {
    129                             jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text(val);
    130                         }
    131                     }
    132                     break;
    133                 case 'required':
    134                     let labelVal = jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text();
    135                     if (jQuery(this).is(':checked')) {
    136                         self.fields_options[self.edit_field_id][current_option] = 1;
    137 
    138                         /* Disable single required if required all active */
    139                         self.fields_options[self.edit_field_id]['required_single'] = 0;
    140                         if (labelVal.slice(-1) == "*") {
    141                             labelVal = labelVal.slice(0, -1);
    142                         }
    143                         jQuery(".wbls-sidebar-field-options-content").find(".wbls-field-option-required_single").prop("checked", false);
    144                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']").removeAttr('data-required');
    145                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']").removeAttr('data-required-group-ids');
    146 
    147                         labelVal += "*";
    148                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text(labelVal);
    149                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field").prop('required', true);
    150                     } else {
    151                         self.fields_options[self.edit_field_id][current_option] = 0;
    152                         if (labelVal.slice(-1) == "*") {
    153                             labelVal = labelVal.slice(0, -1);
    154                         }
    155                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text(labelVal);
    156                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field").prop('required', false);
    157                     }
    158                     break;
    159                 case 'required_single': /* Checkbox field only*/
    160                     let labelValSingle = jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text();
    161                     if (jQuery(this).is(':checked')) {
    162                         self.fields_options[self.edit_field_id][current_option] = 1;
    163                         self.fields_options[self.edit_field_id]['required'] = 0;
    164                         if (labelValSingle.slice(-1) == "*") {
    165                             labelValSingle = labelValSingle.slice(0, -1);
    166                         }
    167                         jQuery(".wbls-sidebar-field-options-content").find(".wbls-field-option-required").prop("checked", false);
    168 
    169                         labelValSingle += "*";
    170                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text(labelValSingle);
    171                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field").prop('required', true);
    172                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']").attr('data-required', 'single');
    173 
    174                         let group_ids = [];
    175                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-row-checkbox").each(function (index, element) {
    176                             let $field = jQuery(element).find(".wbls-field").attr('name');
    177                             let $field_id = $field.replace("wbls_field_", "");
    178                             group_ids.push($field_id);
    179                         });
    180                         group_ids = group_ids.join(",");
    181                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']").attr('data-required-group-ids', group_ids);
    182                     } else {
    183                         self.fields_options[self.edit_field_id][current_option] = 0;
    184                         if (labelValSingle.slice(-1) == "*") {
    185                             labelValSingle = labelValSingle.slice(0, -1);
    186                         }
    187                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-label").text(labelValSingle);
    188                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field").prop('required', false);
    189                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']").removeAttr('data-required');
    190                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']").removeAttr('data-required-group-ids');
    191                     }
    192                     break;
    193                 case 'limit_days_active':
    194                     if (jQuery(this).is(':checked')) {
    195                         self.fields_options[self.edit_field_id]['date_options'][current_option] = '1';
    196                         jQuery(document).find(".wbls-limit_days").closest(".wbls-field-option-row").show();
    197                         let attr = '';
    198                         let limit_days_ob = self.fields_options[self.edit_field_id]['date_options']['limit_days'];
    199                         Object.keys(limit_days_ob).forEach((key) => {
    200                             if (limit_days_ob[key] === '1') {
    201                                 attr += key + ',';
    202                             }
    203                         });
    204                         attr = attr.slice(0, -1);
    205                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-datepicker").attr('data-limit_days', attr);
    206                     } else {
    207                         self.fields_options[self.edit_field_id]['date_options'][current_option] = '0';
    208                         jQuery(document).find(".wbls-limit_days").closest(".wbls-field-option-row").hide();
    209                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-datepicker").attr('data-limit_days', '');
    210                     }
    211                     break;
    212                 case 'disable_past_days':
    213                     if (jQuery(this).is(':checked')) {
    214                         self.fields_options[self.edit_field_id]['date_options'][current_option] = '1';
    215                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-datepicker").attr('data-past_days', 1);
    216                     } else {
    217                         self.fields_options[self.edit_field_id]['date_options'][current_option] = '0';
    218                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-datepicker").attr('data-past_days', 0);
    219                     }
    220                     break;
    221                 case 'limit_hours':
    222                     if (jQuery(this).is(':checked')) {
    223                         self.fields_options[self.edit_field_id]['time_options'][current_option] = '1';
    224                         jQuery(document).find(".wbls-time-limit-row").closest(".wbls-field-option-row").show();
    225                         self.generateTimeOptions(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-time select", {
    226                             limitHours: true,
    227                             timeInterval: jQuery(document).find(".wbls-time-row select[name='time_interval']").val(),
    228                             timeFormat: jQuery(document).find(".wbls-time-row select[name='time_format']").val(),
    229                             startHour: jQuery(document).find(".wbls-time-limit-row select[name='start_time_h']").val(),
    230                             startMinute: jQuery(document).find(".wbls-time-limit-row select[name='start_time_m']").val(),
    231                             startFormat: jQuery(document).find(".wbls-time-limit-row select[name='start_time_f']").val(),
    232                             endHour: jQuery(document).find(".wbls-time-limit-row select[name='end_time_h']").val(),
    233                             endMinute: jQuery(document).find(".wbls-time-limit-row select[name='end_time_m']").val(),
    234                             endFormat: jQuery(document).find(".wbls-time-limit-row select[name='end_time_f']").val(),
    235                         });
    236 
    237                     } else {
    238                         self.fields_options[self.edit_field_id]['time_options'][current_option] = '0';
    239                         jQuery(document).find(".wbls-time-limit-row").closest(".wbls-field-option-row").hide();
    240                         self.generateTimeOptions(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-time select", {
    241                             limitHours: false,
    242                             timeInterval: jQuery(document).find(".wbls-time-row select[name='time_interval']").val(),
    243                             timeFormat: jQuery(document).find(".wbls-time-row select[name='time_format']").val(),
    244                         });
    245 
    246                     }
    247                     break;
    248                 case 'placeholder':
    249                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] input, .wblsform-row[data-field-id='" + self.edit_field_id + "'] textarea").attr('placeholder', val);
    250                     break;
    251                 case 'date-placeholder':
    252                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-date input").attr('placeholder', val);
    253                     self.fields_options[self.edit_field_id]['date_options']['placeholder'] = val;
    254                     break;
    255                 case 'date-mini_label':
    256                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-date .wbls-field-miniLabel").text(val);
    257                     self.fields_options[self.edit_field_id]['date_options']['mini_label'] = val;
    258                     break;
    259                 case 'time-mini_label':
    260                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-time .wbls-field-miniLabel").text(val);
    261                     self.fields_options[self.edit_field_id]['date_options']['mini_label'] = val;
    262                     break;
    263                 case 'description':
    264                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-description").text(val);
    265                     break;
    266                 case 'firstNamePlaceholder':
    267                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-firstName input").attr('placeholder', val);
    268                     break;
    269                 case 'lastNamePlaceholder':
    270                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-lastName input").attr('placeholder', val);
    271                     break;
    272                 case 'middleNamePlaceholder':
    273                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-middleName input").attr('placeholder', val);
    274                     break;
    275                 case 'firstNameMiniLabel':
    276                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-firstName .wbls-field-miniLabel").text(val);
    277                     break;
    278                 case 'lastNameMiniLabel':
    279                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-lastName .wbls-field-miniLabel").text(val);
    280                     break;
    281                 case 'middleNameMiniLabel':
    282                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-middleName .wbls-field-miniLabel").text(val);
    283                     break;
    284                 case 'hideMiddleName':
    285                     if (jQuery(this).is(':checked')) {
    286                         self.fields_options[self.edit_field_id][current_option] = 0;
    287                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-middleName").remove();
    288                     } else {
    289                         let templ = jQuery(document).find("#wbls-template-middleName").html();
    290                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-firstName").after(templ);
    291                         let miniLabel = self.fields_options[self.edit_field_id]['middleNameMiniLabel'];
    292                         let placeholder = self.fields_options[self.edit_field_id]['middleNamePlaceholder'];
    293                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-middleName input").attr('name', self.fields_options[self.edit_field_id]['mname']);
    294                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-middleName input").attr('placeholder', placeholder);
    295                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-middleName .wbls-field-miniLabel").text(miniLabel);
    296                     }
    297                     break;
    298                 case 'streetPlaceholder':
    299                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street input").attr('placeholder', val);
    300                     break;
    301                 case 'street1Placeholder':
    302                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street1 input").attr('placeholder', val);
    303                     break;
    304                 case 'cityPlaceholder':
    305                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-city input").attr('placeholder', val);
    306                     break;
    307                 case 'statePlaceholder':
    308                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-state input").attr('placeholder', val);
    309                     break;
    310                 case 'postalPlaceholder':
    311                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-postal input").attr('placeholder', val);
    312                     break;
    313                 case 'countryPlaceholder':
    314                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-country input").attr('placeholder', val);
    315                     break;
    316                 case 'streetMiniLabel':
    317                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']  .wbls-field-street .wbls-field-miniLabel").text(val);
    318                     break;
    319                 case 'street1MiniLabel':
    320                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']  .wbls-field-street1 .wbls-field-miniLabel").text(val);
    321                     break;
    322                 case 'cityMiniLabel':
    323                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']  .wbls-field-city .wbls-field-miniLabel").text(val);
    324                     break;
    325                 case 'stateMiniLabel':
    326                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']  .wbls-field-state .wbls-field-miniLabel").text(val);
    327                     break;
    328                 case 'postalMiniLabel':
    329                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']  .wbls-field-postal .wbls-field-miniLabel").text(val);
    330                     break;
    331                 case 'countryMiniLabel':
    332                     jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "']  .wbls-field-country .wbls-field-miniLabel").text(val);
    333                     break;
    334                 case 'hideStreet':
    335                     if (jQuery(this).is(':checked')) {
    336                         self.fields_options[self.edit_field_id][current_option] = 1;
    337                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street").remove();
    338                     } else {
    339                         let templ = jQuery(document).find("#wbls-template-street").html();
    340                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-address-container").prepend(templ);
    341                         let miniLabel = self.fields_options[self.edit_field_id]['streetMiniLabel'];
    342                         let placeholder = self.fields_options[self.edit_field_id]['streetPlaceholder'];
    343                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street input").attr('name', self.fields_options[self.edit_field_id]['streetName']);
    344                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street input").attr('placeholder', placeholder);
    345                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street .wbls-field-miniLabel").text(miniLabel);
    346                     }
    347                     break;
    348                 case 'hideStreet1':
    349                     if (jQuery(this).is(':checked')) {
    350                         self.fields_options[self.edit_field_id][current_option] = 1;
    351                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street1").remove();
    352                     } else {
    353                         let templ = jQuery(document).find("#wbls-template-street1").html();
    354                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-address-container > div:nth-child(1)").after(templ);
    355                         let miniLabel = self.fields_options[self.edit_field_id]['street1MiniLabel'];
    356                         let placeholder = self.fields_options[self.edit_field_id]['street1Placeholder'];
    357                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street1 input").attr('name', self.fields_options[self.edit_field_id]['street1Name']);
    358                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street1 input").attr('placeholder', placeholder);
    359                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-street1 .wbls-field-miniLabel").text(miniLabel);
    360                     }
    361                     break;
    362                 case 'hideCity':
    363                     if (jQuery(this).is(':checked')) {
    364                         self.fields_options[self.edit_field_id][current_option] = 1;
    365                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-city").remove();
    366                     } else {
    367                         let templ = jQuery(document).find("#wbls-template-city").html();
    368                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-address-container .wbls-address-row").eq(0).prepend(templ);
    369                         let miniLabel = self.fields_options[self.edit_field_id]['cityMiniLabel'];
    370                         let placeholder = self.fields_options[self.edit_field_id]['cityPlaceholder'];
    371                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-city input").attr('name', self.fields_options[self.edit_field_id]['cityName']);
    372                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-city input").attr('placeholder', placeholder);
    373                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-city .wbls-field-miniLabel").text(miniLabel);
    374                     }
    375                     break;
    376                 case 'hideState':
    377                     if (jQuery(this).is(':checked')) {
    378                         self.fields_options[self.edit_field_id][current_option] = 1;
    379                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-state").remove();
    380                     } else {
    381                         let templ = jQuery(document).find("#wbls-template-state").html();
    382                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-address-container .wbls-address-row").eq(0).append(templ);
    383                         let miniLabel = self.fields_options[self.edit_field_id]['stateMiniLabel'];
    384                         let placeholder = self.fields_options[self.edit_field_id]['statePlaceholder'];
    385                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-state input").attr('name', self.fields_options[self.edit_field_id]['stateName']);
    386                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-state input").attr('placeholder', placeholder);
    387                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-state .wbls-field-miniLabel").text(miniLabel);
    388                     }
    389                     break;
    390                 case 'hidePostal':
    391                     if (jQuery(this).is(':checked')) {
    392                         self.fields_options[self.edit_field_id][current_option] = 1;
    393                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-postal").remove();
    394                     } else {
    395                         let templ = jQuery(document).find("#wbls-template-postal").html();
    396                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-address-container .wbls-address-row").eq(1).prepend(templ);
    397                         let miniLabel = self.fields_options[self.edit_field_id]['postalMiniLabel'];
    398                         let placeholder = self.fields_options[self.edit_field_id]['postalPlaceholder'];
    399                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-postal input").attr('name', self.fields_options[self.edit_field_id]['postalName']);
    400                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-postal input").attr('placeholder', placeholder);
    401                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-postal .wbls-field-miniLabel").text(miniLabel);
    402                     }
    403                     break;
    404                 case 'hideCountry':
    405                     if (jQuery(this).is(':checked')) {
    406                         self.fields_options[self.edit_field_id][current_option] = 1;
    407                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-country").remove();
    408                     } else {
    409                         let templ = jQuery(document).find("#wbls-template-country").html();
    410                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-address-container .wbls-address-row").eq(1).append(templ);
    411                         let miniLabel = self.fields_options[self.edit_field_id]['countryMiniLabel'];
    412                         let placeholder = self.fields_options[self.edit_field_id]['countryPlaceholder'];
    413                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-country input").attr('name', self.fields_options[self.edit_field_id]['countryName']);
    414                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-country input").attr('placeholder', placeholder);
    415                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field-country .wbls-field-miniLabel").text(miniLabel);
    416                     }
    417                     break;
    418                 case 'multiple':
    419                     let input = jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] input");
    420                     let currentName = input.attr('name');  // Get the current name attribute
    421                     if (jQuery(this).is(':checked')) {
    422                         self.fields_options[self.edit_field_id][current_option] = 1;
    423                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field").prop('multiple', true);
    424                         let newName = currentName + '[]';
    425                         input.attr('name', newName);
    426                     } else {
    427                         jQuery(".wblsform-row[data-field-id='" + self.edit_field_id + "'] .wbls-field").prop('multiple', false);
    428                         let newName = currentName.replace("[]", "");
    429                         input.attr('name', newName);
    430 
    431                     }
    432                     break;
    433                 case 'next_button_text':
    434                     jQuery(".wblsform-row-pageButtonNext .wbls-next-button").text(val);
    435                     break;
    436 
    437                 case 'previous_button_text':
    438                     jQuery(".wblsform-row-pageButtonPrev .wbls-previous-button").text(val);
    439                     break;
    440 
    441                 case 'show_previous':
    442                     if (jQuery(this).val() === "1") {
    443                         let prevButtonTemplate = jQuery(document).find("#wbls-template-page-previous-button").html();
    444 
    445                         jQuery(document).find(".wblsform-page-and-images").each(function (index) {
    446                             if (0 !== index) {
    447                                 if (jQuery(this).find(".wblsform-row-pageButtonNextPrev-container").length) {
    448                                     jQuery(this).find(".wblsform-row-pageButtonNextPrev-container").prepend(prevButtonTemplate);
    449                                 } else {
    450                                     let nextPrevContTemplate = jQuery(document).find("#wbls-template-page-next-prev-container").html();
    451                                     jQuery(this).append(nextPrevContTemplate);
    452                                     jQuery(this).find(".wblsform-row-pageButtonNextPrev-container").prepend(prevButtonTemplate);
    453                                 }
    454                                 jQuery(this).find(".wblsform-row-pageButtonPrev").attr("data-field-id", self.edit_field_id);
    455                             }
    456                         });
    457                     } else {
    458                         jQuery(".wblsform-row-pageButtonPrev.wblsform-row-page").remove();
    459                     }
    460                     break;
    461                 default:
    462                 // code block
    463             }
     123
     124            // Delegate to option handler
     125            self.optionHandler.handleOptionChange(current_option, jQuery(this), val, self.edit_field_id);
    464126        });
    465127
     
    877539
    878540        jQuery(document).on('click', '.wbls-outgoing-map-row .dashicons-trash', function () {
    879             debugger;
    880541            jQuery(this).closest('.wbls-outgoing-map-row').remove();
    881542        });
     
    1245906                this.edit_rating_field(values);
    1246907                break;
     908            case 'slider':
     909                this.remove_field_option_html(".wbls-field-option-placeholder");
     910                this.edit_slider_field(values);
     911                break;
    1247912        }
    1248913
     
    17811446            rating: () => {
    17821447                $newField.find(".wbls-rating input").attr("name", field.name);
     1448            },
     1449            slider: () => {
     1450                $newField.find(".wbls-slider-container input.wbls-slider-input").attr("name", field.name);
    17831451            }
    17841452        };
  • whistleblowing-system/trunk/admin/controllers/ControllerThemes.php

    r3451009 r3461790  
    135135                                            'hover_color' => '#ffffff',
    136136                                            'border_border_color' => '#bfc1c5',
     137                                        ),
     138                        'slider_fields' =>
     139                                        array (
     140                                            'height' => '6',
     141                                            'font_size' => '14',
     142                                            'color' => '#000000',
     143                                            'font_weight' => 'normal',
     144                                            'active_color' => '#000000',
     145                                            'active_font_weight' => 'bold',
     146                                            'pointer_width' => '20',
     147                                            'pointer_height' => '20',
     148                                            'pointer_border_width' => '2',
     149                                            'pointer_border_style' => 'solid',
     150                                            'pointer_border_color' => '#ffffff',
     151                                            'pointer_border_radius' => '10',
     152                                            'pointer_bg_color' => '#000000',
     153                                            'bg_color' => '#dddddd',
    137154                                        ),
    138155                        'new_case_button_fields' =>
     
    638655        /* End rating styles */
    639656
     657        /* Slider styles */
     658        $wbls_theme .= ".wbls-form-container .wbls-form .wbls-slider-container .wbls-slider-input {
     659            height: ".$data['slider_fields']['height']."px;
     660            background: ".$data['slider_fields']['bg_color'].";
     661        }\n";
     662
     663        $wbls_theme .= ".wbls-form-container .wbls-form .wbls-slider-container .wbls-slider-input::-webkit-slider-thumb {
     664            width: ".$data['slider_fields']['pointer_width']."px;
     665            height: ".$data['slider_fields']['pointer_height']."px;
     666            background: ".$data['slider_fields']['pointer_bg_color'].";
     667            border-width: ".$data['slider_fields']['pointer_border_width']."px;
     668            border-style: ".$data['slider_fields']['pointer_border_style'].";
     669            border-color: ".$data['slider_fields']['pointer_border_color'].";
     670            border-radius: ".$data['slider_fields']['pointer_border_radius']."px;
     671        }\n";
     672        $wbls_theme .= ".wbls-form-container .wbls-form .wbls-slider-container .wbls-slider-input::-moz-range-thumb {
     673            width: ".$data['slider_fields']['pointer_width']."px;
     674            height: ".$data['slider_fields']['pointer_height']."px;
     675            background: ".$data['slider_fields']['pointer_bg_color'].";
     676            border-width: ".$data['slider_fields']['pointer_border_width']."px;
     677            border-style: ".$data['slider_fields']['pointer_border_style'].";
     678            border-color: ".$data['slider_fields']['pointer_border_color'].";
     679            border-radius: ".$data['slider_fields']['pointer_border_radius']."px;
     680        }\n";
     681
     682        $wbls_theme .= ".wbls-form-container .wbls-form .wbls-slider-container .wbls-slider-meta {
     683            font-size: ".$data['slider_fields']['font_size']."px; 
     684            color: ".$data['slider_fields']['color'].";
     685            font-weight: ".$data['slider_fields']['font_weight'].";     
     686        }\n";
     687
     688        $wbls_theme .= ".wbls-form-container .wbls-form .wbls-slider-container .wbls-slider-value {
     689            font-weight: ".$data['slider_fields']['active_font_weight']."; 
     690            color: ".$data['slider_fields']['active_color'].";     
     691        }\n";
     692        /* End Slider styles */
     693
    640694        $wbls_theme .= ".wbls-front-buttons-container .wbls-new-case-button {
    641695            width: ".$data['new_case_button_fields']['width'].";
  • whistleblowing-system/trunk/admin/includes/fields_templates.php

    r3451009 r3461790  
    425425    <div class="wbls-field-option-row">
    426426        <label><?php esc_html_e('Country', 'whistleblowing-system') ?></label>
    427         <div class="wbls-field-option-country wbls-field-option-address-cont">
    428             <div>
    429                 <input type="text" class="wbls-field-option-placeholder wbls-field-option" data-option="countryPlaceholder">
    430                 <label class="wbls-field-miniLabel"><?php esc_html_e('Placeholder', 'whistleblowing-system'); ?></label>
    431             </div>
     427        <div class="wbls-field-option-country wbls-field-option-address-cont">           
    432428            <div>
    433429                <input type="text" class="wbls-field-option-miniLabel wbls-field-option" data-option="countryMiniLabel" value="<?php esc_attr_e('Country', 'whistleblowing-system') ?>">
  • whistleblowing-system/trunk/admin/whistleblower_form_edit_page.php

    r3451009 r3461790  
    267267                'next_button_text' => 'Next',
    268268                'previous_button_text' => 'Previous',
    269                 'show_previous' => 0,
     269                'show_previous' => 1,
    270270                'default_option' => 0,
    271271                'icon' => '',
     
    397397                    'tabs' => array('general', 'conditions'),
    398398            ),
     399            'slider' => array(
     400                    'type' => 'slider',
     401                    'title' => 'Slider',
     402                    'description' => '',
     403                    'value' => '',
     404                    'name' => '',
     405                    'sliderMin' => 0,
     406                    'sliderMax' => 50,
     407                    'sliderStep' => 1,
     408                    'sliderDefault' => 25,
     409                    'icon' => '',
     410                    'order' => '12',
     411                    'public' => true,
     412                    'class' => '',
     413                    'id' => '',
     414                    'label' => 'Slider',
     415                    'pro' => 1,
     416                    'required' => 0,
     417                    'tabs' => array('general', 'conditions'),
     418            ),
    399419
    400420    );
     
    475495        wp_enqueue_script( 'jquery-ui-sortable' );
    476496        wp_enqueue_script( WBLS_PREFIX . '-conditions');
     497        wp_enqueue_script( WBLS_PREFIX . '-optionHandler');
    477498        wp_enqueue_script( WBLS_PREFIX . '-edit');
    478499        wp_localize_script(WBLS_PREFIX . '-edit', 'wbls_edit', array(
  • whistleblowing-system/trunk/admin/whistleblower_theme_edit_page.php

    r3451009 r3461790  
    420420
    421421        </div>
     422
     423        <div class="wbls-style-item wbls-cols-50">
     424            <div class="wbls-style-item-title">
     425                <?php esc_html_e('Slider', 'whistleblowing-system') ?>
     426                <span class="dashicons dashicons-arrow-down-alt2"></span>
     427            </div>
     428            <div class="wbls-style-item-content" style="display: none;">
     429                <?php $this->slider_styles($this->default['slider_fields'], 'slider_fields_'); ?>
     430            </div>
     431
     432        </div>
    422433        <?php
    423434    }
     
    10131024    }
    10141025
     1026    public function slider_styles($params, $name_prefix) { ?>
     1027        <div class="wbls-style-row">
     1028            <label>Slider Height</label>
     1029            <input type="text" name="<?php echo esc_attr($name_prefix); ?>height" value="<?php echo esc_attr($params['height']); ?>">
     1030            <p class="cf7b-description">Use CSS type values. Ex 34 or auto</p>
     1031        </div>
     1032
     1033        <div class="wbls-style-row">
     1034            <label>Slider Background Color</label>
     1035            <input type="text" name="<?php echo esc_attr($name_prefix); ?>bg_color" value="<?php echo esc_attr($params['bg_color']); ?>" class="button_bg_color" />
     1036        </div>
     1037
     1038        <div class="wbls-style-row">
     1039            <label>Pointer Width</label>
     1040            <input type="text" name="<?php echo esc_attr($name_prefix); ?>pointer_width" value="<?php echo esc_attr($params['pointer_width']); ?>">
     1041            <p class="cf7b-description">Use CSS type values. Ex 34 or auto</p>
     1042        </div>
     1043        <div class="wbls-style-row">
     1044            <label>Pointer Height</label>
     1045            <input type="text" name="<?php echo esc_attr($name_prefix); ?>pointer_height" value="<?php echo esc_attr($params['pointer_height']); ?>">
     1046            <p class="cf7b-description">Use CSS type values. Ex 34 or auto</p>
     1047        </div>
     1048
     1049        <div class="wbls-style-row">
     1050            <label>Pointer Background Color</label>
     1051            <input type="text" name="<?php echo esc_attr($name_prefix); ?>pointer_bg_color" value="<?php echo esc_attr($params['pointer_bg_color']); ?>" class="button_bg_color" />
     1052        </div>
     1053        <div class="wbls-style-row">
     1054            <label>Pointer Border Width</label>
     1055            <input type="number" name="<?php echo esc_attr($name_prefix); ?>pointer_border_width" min="0" value="<?php echo esc_attr($params['pointer_border_width']); ?>">
     1056            <span class="cf7b-um">px</span>
     1057        </div>
     1058        <div class="wbls-style-row">
     1059            <label>Pointer Border Type</label>
     1060            <select name="<?php echo esc_attr($name_prefix); ?>pointer_border_style">
     1061                <option value="solid" <?php echo ($params['pointer_border_style'] == 'solid') ? 'selected' : '' ?>>Solid</option>
     1062                <option value="dotted" <?php echo ($params['pointer_border_style'] == 'dotted') ? 'selected' : '' ?>>Dotted</option>
     1063                <option value="dashed" <?php echo ($params['pointer_border_style'] == 'dashed') ? 'selected' : '' ?>>Dashed</option>
     1064                <option value="double" <?php echo ($params['pointer_border_style'] == 'double') ? 'selected' : '' ?>>Double</option>
     1065                <option value="groove" <?php echo ($params['pointer_border_style'] == 'groove') ? 'selected' : '' ?>>Groove</option>
     1066                <option value="ridge" <?php echo ($params['pointer_border_style'] == 'ridge') ? 'selected' : '' ?>>Ridge</option>
     1067                <option value="inset" <?php echo ($params['pointer_border_style'] == 'inset') ? 'selected' : '' ?>>Inset</option>
     1068                <option value="outset" <?php echo ($params['pointer_border_style'] == 'outset') ? 'selected' : '' ?>>Outset</option>
     1069                <option value="initial" <?php echo ($params['pointer_border_style'] == 'initial') ? 'selected' : '' ?>>Initial</option>
     1070                <option value="inherit" <?php echo ($params['pointer_border_style'] == 'inherit') ? 'selected' : '' ?>>Inherit</option>
     1071            </select>
     1072        </div>
     1073        <div class="wbls-style-row">
     1074            <label>Pointer Border Color</label>
     1075            <input type="text" name="<?php echo esc_attr($name_prefix); ?>pointer_border_color" value="<?php echo esc_attr($params['pointer_border_color']); ?>" class="button_border_color" />
     1076        </div>
     1077        <div class="wbls-style-row">
     1078            <label>Pointer Border Radius</label>
     1079            <input type="number" name="<?php echo esc_attr($name_prefix); ?>pointer_border_radius" value="<?php echo esc_attr($params['pointer_border_radius']); ?>">
     1080            <span class="cf7b-um">px</span>
     1081        </div>
     1082
     1083        <div class="wbls-style-row">
     1084            <label>Min/Max Font Size</label>
     1085            <input type="text" name="<?php echo esc_attr($name_prefix); ?>font_size" value="<?php echo esc_attr($params['font_size']); ?>">
     1086            <span class="cf7b-um">px</span>
     1087        </div>
     1088        <div class="wbls-style-row">
     1089            <label>Min/Max Font Color</label>
     1090            <input type="text" name="<?php echo esc_attr($name_prefix); ?>color" value="<?php echo esc_attr($params['color']); ?>" class="button_color" />
     1091        </div>
     1092        <div class="wbls-style-row">
     1093            <label>Min/Max Font Weight</label>
     1094            <select name="<?php echo esc_attr($name_prefix); ?>font_weight">
     1095                <option value=""></option>
     1096                <option value="normal" <?php echo ($params['font_weight'] == 'normal') ? 'selected' : '' ?>>Normal</option>
     1097                <option value="bold" <?php echo ($params['font_weight'] == 'bold') ? 'selected' : '' ?>>Bold</option>
     1098                <option value="bolder" <?php echo ($params['font_weight'] == 'bolder') ? 'selected' : '' ?>>Bolder</option>
     1099                <option value="lighter" <?php echo ($params['font_weight'] == 'lighter') ? 'selected' : '' ?>>Lighter</option>
     1100                <option value="initial" <?php echo ($params['font_weight'] == 'initial') ? 'selected' : '' ?>>Initial</option>
     1101            </select>
     1102        </div>
     1103
     1104        <div class="wbls-style-row">
     1105            <label>Value Font Color</label>
     1106            <input type="text" name="<?php echo esc_attr($name_prefix); ?>active_color" value="<?php echo esc_attr($params['active_color']); ?>" class="button_color" />
     1107        </div>
     1108        <div class="wbls-style-row">
     1109            <label>Value Font Weight</label>
     1110            <select name="<?php echo esc_attr($name_prefix); ?>active_font_weight">
     1111                <option value=""></option>
     1112                <option value="normal" <?php echo ($params['active_font_weight'] == 'normal') ? 'selected' : '' ?>>Normal</option>
     1113                <option value="bold" <?php echo ($params['active_font_weight'] == 'bold') ? 'selected' : '' ?>>Bold</option>
     1114                <option value="bolder" <?php echo ($params['active_font_weight'] == 'bolder') ? 'selected' : '' ?>>Bolder</option>
     1115                <option value="lighter" <?php echo ($params['active_font_weight'] == 'lighter') ? 'selected' : '' ?>>Lighter</option>
     1116                <option value="initial" <?php echo ($params['active_font_weight'] == 'initial') ? 'selected' : '' ?>>Initial</option>
     1117            </select>
     1118        </div>
     1119
     1120
     1121        <?php
     1122    }
     1123
    10151124    public function tabs_styles($params, $name_prefix) {
    10161125        ?>
  • whistleblowing-system/trunk/config.php

    r3451009 r3461790  
    55
    66if (!defined('WBLS_VERSION')) {
    7     define('WBLS_VERSION', '1.4.8');
     7    define('WBLS_VERSION', '1.4.9');
    88}
    99if (!defined('WBLS_PREFIX')) {
  • whistleblowing-system/trunk/frontend/Controller.php

    r3434724 r3461790  
    1313    public $user_token = '';
    1414    public $admin_token = '';
     15    public $whistleblower_active = 1;
    1516
    1617    public $anonymous = false;
     
    426427            add_post_meta( $insert, 'wbls_form_id', intval($form_id), true );
    427428
    428             $whistleblower_active = WBLSLibrary::is_whistleblower_active($form_id);
    429             if( $whistleblower_active || $this->anonymous) {
     429            $this->whistleblower_active = WBLSLibrary::is_whistleblower_active($form_id);
     430            if( $this->whistleblower_active || $this->anonymous) {
    430431                $wbls_global_settings = json_decode( get_option( 'wbls_global_settings' ), true );
    431432                $token_length = 32;
     
    459460                    ]);
    460461                    wp_send_json_success( array(
    461                         'whistleblower_active' => $whistleblower_active,
     462                        'whistleblower_active' => $this->whistleblower_active,
    462463                        'token' => $this->user_token,
    463464                        'anonymous' => $this->anonymous,
     
    472473                ]);
    473474                wp_send_json_success( array(
    474                     'whistleblower_active' => $whistleblower_active
     475                    'whistleblower_active' => $this->whistleblower_active
    475476                ), 200 );
    476477            }
     
    529530            '{Form ID}'         => 'Form ID: ' . $this->form_id,
    530531            '{Submission ID}'   => 'Submission ID: ' . $this->submission_id,
    531             '{Admin Token}'   => "Admin Token: " . $this->admin_token,
    532             '{User Token}'   => "User Token: " . $this->user_token,
    533532        ];
     533
     534        if ( $this->whistleblower_active ) {
     535            $replacements['{Admin Token}'] = "Admin Token: " . $this->admin_token;
     536            $replacements['{User Token}'] = "User Token: " . $this->user_token;
     537        }
    534538        $body = strtr($body, $replacements);
    535539
  • whistleblowing-system/trunk/frontend/assets/css/style.css

    r3451009 r3461790  
    17411741}
    17421742
     1743/* Slider field styles */
     1744.wbls-slider-container {
     1745    width: 100%;
     1746    box-sizing: border-box;
     1747    display: block;
     1748}
     1749
     1750.wbls-slider-input {
     1751    width: 100%;
     1752    height: 6px;
     1753    -webkit-appearance: none;
     1754    appearance: none;
     1755    background: #ddd;
     1756    border-radius: 3px;
     1757    outline: none;
     1758}
     1759
     1760.wbls-form-container .wbls-form .wbls-slider-container .wbls-slider-input::-webkit-slider-thumb {
     1761    -webkit-appearance: none;
     1762    appearance: none;
     1763    width: 20px;
     1764    height: 20px;
     1765    border-radius: 50%;
     1766    background: #000000;
     1767    cursor: pointer;
     1768    border: 2px solid #fff;
     1769    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
     1770}
     1771
     1772.wbls-slider-input::-moz-range-thumb {
     1773    width: 20px;
     1774    height: 20px;
     1775    border-radius: 50%;
     1776    background: #000000;
     1777    cursor: pointer;
     1778    border: 2px solid #fff;
     1779    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
     1780}
     1781
     1782.wbls-slider-meta {
     1783    display: flex;
     1784    justify-content: space-between;
     1785    margin-top: 8px;
     1786    font-size: 14px;
     1787    color: #666;
     1788}
     1789
     1790.wbls-slider-value {
     1791    font-weight: bold;
     1792    color: #000000;
     1793}
     1794
    17431795/* Media */
    17441796@media screen and (max-width: 840px){
  • whistleblowing-system/trunk/frontend/assets/js/conditions.js

    r3451009 r3461790  
    1919        if ($form.data('wbls-conditions-init')) return;
    2020        $form.data('wbls-conditions-init', true);
     21
     22        function isHiddenByCondition(fieldId) {
     23            const $row = $form.find('.wblsform-row[data-field-id="' + fieldId + '"]');
     24            return $row.length ? $row.hasClass('wbls-hidden-by-condition') : false;
     25        }
     26
     27        function setRowVisibility($row, shouldShow) {
     28            if (shouldShow) {
     29                $row.show().removeClass('wbls-hidden-by-condition');
     30            } else {
     31                $row.hide().addClass('wbls-hidden-by-condition');
     32            }
     33        }
    2134
    2235        // Helper to get field config for a field ID (handles compound fields)
     
    4760
    4861        // Helper to get field value (handles compound fields)
    49         function getFieldValue(field, name) {
     62        function getFieldValue(field, name, fieldId) {
    5063            if (!field) return '';
    5164
     65            // If the SOURCE field is hidden by our conditional logic, it must behave as empty/false.
     66            // (Do NOT use `:visible` here because multi-step/page navigation can hide fields too.)
     67            if (fieldId && isHiddenByCondition(fieldId)) {
     68                return field.type === 'checkbox' ? false : '';
     69            }
     70
    5271            const $el = $form.find('[name="' + name + '"]');
    5372
    54             // Handle rating fields
     73            // Rating fields
    5574            if (field.type === 'rating') {
    56                 const $ratingContainer = $el.closest('.wbls-rating');
    57                 if ($ratingContainer.length && !$ratingContainer.is(':visible')) {
    58                     return '';
    59                 }
     75                // Same rule: only empty if hidden by conditions, not if hidden by step navigation.
    6076                const $checked = $form.find('[name="' + name + '"]:checked');
    61                 return $checked.length ? $checked.val() || '' : '';
    62             }
    63 
    64             // For compound field sub-fields, check parent visibility
     77                return $checked.length ? ($checked.val() || '') : '';
     78            }
     79
     80            // Compound field sub-fields: if parent hidden by conditions => empty/false
    6581            if (field.isSubField) {
    66                 // Find the parent field row
    6782                const parentFieldId = field.subFieldId.split('_')[0];
    68                 const $parentRow = $form.find('.wblsform-row[data-field-id="' + parentFieldId + '"]');
    69                 if ($parentRow.length && !$parentRow.is(':visible')) {
     83                if (isHiddenByCondition(parentFieldId)) {
    7084                    return field.type === 'checkbox' ? false : '';
    7185                }
    72             } else if (!$el.is(':visible')) {
    73                 // For regular fields
    74                 return field.type === 'checkbox' ? false : '';
    7586            }
    7687
    7788            switch (field.type) {
    7889                case 'checkbox':
     90                    // Single checkbox
    7991                    return $el.is(':checked');
    8092
     
    128140
    129141        function evaluate() {
    130             Object.keys(rules).forEach(function (fieldId) {
    131                 const fieldConfig = rules[fieldId];
    132                 if (!fieldConfig || !fieldConfig.conditions) return;
    133 
    134                 let matched = false;
    135 
    136                 if (Array.isArray(fieldConfig.conditions)) {
    137                     fieldConfig.conditions.forEach(function (group) {
    138                         if (Array.isArray(group)) {
     142            // Run multiple passes because visibility changes can affect other rules.
     143            // Example: field1 hides field2, and field3 depends on field2.
     144            // One pass may evaluate field3 before field2 gets hidden, so we iterate.
     145            let changed = false;
     146            let guard = 0;
     147            const MAX_PASSES = 8;
     148
     149            do {
     150                changed = false;
     151                guard++;
     152
     153                Object.keys(rules).forEach(function (fieldId) {
     154                    const fieldConfig = rules[fieldId];
     155                    if (!fieldConfig || !fieldConfig.conditions) return;
     156
     157                    let matched = false;
     158
     159                    if (Array.isArray(fieldConfig.conditions)) {
     160                        fieldConfig.conditions.forEach(function (group) {
     161                            if (!Array.isArray(group)) return;
     162
    139163                            let groupMatched = true;
    140164
     
    142166                                if (!groupMatched) return;
    143167
    144                                 // Use new helper function to get field config
    145168                                const field = getFieldConfig(rule.field_id);
    146 
    147169                                if (!field) {
    148                                     console.warn('Field not found for ID:', rule.field_id, 'Rule:', rule);
    149170                                    groupMatched = false;
    150171                                    return;
    151172                                }
    152173
    153                                 const value = getFieldValue(field, rule.field_name);
     174                                const value = getFieldValue(field, rule.field_name, rule.field_id);
    154175                                const ruleMatched = checkCondition(
    155176                                    value,
     
    159180                                );
    160181
    161                                 if (!ruleMatched) {
    162                                     groupMatched = false;
    163                                 }
     182                                if (!ruleMatched) groupMatched = false;
    164183                            });
    165184
    166                             if (groupMatched) {
    167                                 matched = true;
    168                             }
    169                         }
    170                     });
    171                 }
    172 
    173                 const $row = $form.find(
    174                     '.wblsform-row[data-field-id="' + fieldId + '"]'
    175                 );
    176 
    177                 if ($row.length) {
    178                     const showField = fieldConfig.showField === "1" ||
     185                            if (groupMatched) matched = true;
     186                        });
     187                    }
     188
     189                    const $row = $form.find('.wblsform-row[data-field-id="' + fieldId + '"]');
     190                    if (!$row.length) return;
     191
     192                    const showField =
     193                        fieldConfig.showField === "1" ||
    179194                        fieldConfig.showField === true ||
    180195                        fieldConfig.showField === 1;
    181196
    182                     if (showField) {
    183                         matched ? $row.show() : $row.hide();
     197                    const shouldShow = showField ? matched : !matched;
     198
     199                    // Detect if state actually changes (including our hidden-by-condition marker)
     200                    const isCurrentlyVisible = $row.is(':visible');
     201                    const isCurrentlyHiddenByCondition = $row.hasClass('wbls-hidden-by-condition');
     202
     203                    if (shouldShow) {
     204                        if (!isCurrentlyVisible || isCurrentlyHiddenByCondition) {
     205                            setRowVisibility($row, true);
     206                            changed = true;
     207                        }
    184208                    } else {
    185                         matched ? $row.hide() : $row.show();
    186                     }
    187                 }
    188             });
     209                        if (isCurrentlyVisible || !isCurrentlyHiddenByCondition) {
     210                            setRowVisibility($row, false);
     211                            changed = true;
     212                        }
     213                    }
     214                });
     215
     216            } while (changed && guard < MAX_PASSES);
    189217        }
    190218
  • whistleblowing-system/trunk/includes/class-wbls-whistleblower.php

    r3434724 r3461790  
    401401
    402402        wp_register_script(
     403            WBLS_PREFIX . '-optionHandler',
     404            WBLS_URL . '/admin/assets/js/optionHandler.js',
     405            array( 'jquery' ),
     406            WBLS_VERSION
     407        );
     408
     409        wp_register_script(
    403410            WBLS_PREFIX . '-edit',
    404411            WBLS_URL . '/admin/assets/js/edit.js',
    405             array( 'jquery', 'jquery-ui-draggable', 'wbls-conditions', 'wp-editor' ),
     412            array( 'jquery', 'jquery-ui-draggable', 'wbls-conditions', 'wp-editor', 'wbls-optionHandler' ),
    406413            WBLS_VERSION
    407414        );
  • whistleblowing-system/trunk/library.php

    r3451009 r3461790  
    165165                    'value' => array(),
    166166                    'placeholder' => array(),
     167                    'min' => array(),
     168                    'max' => array(),
     169                    'step' => array(),
    167170                    'class' => array(),
    168171                    'id' => array(),
     
    446449            ),
    447450            'main' => array(
     451                    'class' => array(),
     452                    'id' => array(),
     453                    'style' => array(),
     454            ),
     455            'output' => array(
    448456                    'class' => array(),
    449457                    'id' => array(),
  • whistleblowing-system/trunk/readme.txt

    r3451009 r3461790  
    11=== Whistleblowing & Contact Form – Secure, Anonymous, Drag & Drop Builder ===
    22Contributors: pokhar
     3Donate link: https://buymeacoffee.com/whistleblowing
    34Tags:  whistleblowing, form, whistleblower, secure contact form, anonymous
    45Requires at least: 5.2
    56Tested up to: 6.9
    67Requires PHP: 7.4
    7 Stable tag: 1.4.8
     8Stable tag: 1.4.9
    89License: GPLv3
    910License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    143144
    144145== Changelog ==
     146= 1.4.9 =
     147Added: Slider field (Pro)
     148Fixed: Conditional logic in case of multipage form
     149
    145150= 1.4.8 =
    146151Added: Rating field (Pro)
    147152Changed: Conditional fields logic
    148 Changed: Themes page (Pro)
     153Changed: Themes page
    149154
    150155= 1.4.7 =
  • whistleblowing-system/trunk/whistleblowing.php

    r3451009 r3461790  
    44 * Plugin URI:  https://whistleblowing-form.de
    55 * Description: Whistleblowing system form is the ultimate solution for effortlessly creating and managing contact and whistleblowing forms.
    6  * Version:     1.4.8
     6 * Version:     1.4.9
    77 * Author:      Whistleblowing System Team
    88 * Author URI:  https://whistleblowing-form.de
Note: See TracChangeset for help on using the changeset viewer.