Commit d9d3b793 authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3270916 by RenatoG: Implement a validation and unbind to avoid spaces...

Issue #3270916 by RenatoG: Implement a validation and unbind to avoid spaces in the multifields of block class
parent e3955159
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -12,9 +12,13 @@
      // Hide the parent of hidden items on block class field.
      $('.hidden-class-field').parent().css( "display", "none" );

      $('.multiple-textfield').keyup(function() {
        $(this).val($(this).val().replace(/ /g, ""));
      });

      // On click to add another item, prevent default to stop going to another
      // page.
      $(".block-class-add-another-item").on( "click", function(event) {
      $(".block-class-add-another-item").unbind().click(function(event) {

        // Prevent Default to stop the normal behavior and avoid going to
        // another page.
@@ -33,7 +37,7 @@

      // On click to remove item, prevent default to stop going to another
      // page.
      $(".block-class-remove-item").on( "click", function(event) {
      $(".block-class-remove-item").unbind().click(function(event) {

        // Prevent Default to stop the normal behavior and avoid going to
        // another page.
+2 −1
Original line number Diff line number Diff line
@@ -390,9 +390,10 @@ class BlockClassHelperService {
            '#maxlength' => $maxlength_block_class_field,
          ];

          $form['third_party_settings']['block_class']['classes_' . $i]['#attributes']['class'][] = 'multiple-textfield';

          if ($i >= 1) {
            $form['third_party_settings']['block_class']['classes_' . $i]['#attributes']['class'][] = 'hidden-class-field';
            $form['third_party_settings']['block_class']['classes_' . $i]['#attributes']['class'][] = 'multiple-textfield';
          }

        }