Skip to content

Commit

Permalink
Fixed validation message overlapping text for radio field.
Browse files Browse the repository at this point in the history
  • Loading branch information
rilwis committed Dec 1, 2017
1 parent 852ef80 commit d7a5d35
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
22 changes: 11 additions & 11 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
.rwmb-label > label {
font-weight: 600;
}
.rwmb-label.required > span {
color: #c00;
.rwmb-required {
color: #dc3232;
font-weight: bold;
margin-left: 3px;
}
Expand Down Expand Up @@ -95,15 +95,15 @@
}

/* jQuery validation */
label.error {
padding-left: 3px;
color: red;
}
input.error,
textarea.error,
select.error {
border-color: #c00 !important;
background: #ffebe8 !important;
p.rwmb-error {
color: #dc3232;
margin: 2px 0 5px;
}
input.rwmb-error.rwmb-error,
textarea.rwmb-error,
select.rwmb-error {
border-color: #dc3232;
background: #ffebe8;
}

/* Utilities
Expand Down
9 changes: 7 additions & 2 deletions js/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ jQuery( function ( $ ) {
$form.siblings( '#message' ).remove();
$form.before( '<div id="message" class="error"><p>' + rwmbValidate.summaryMessage + '</p></div>' );
},
ignore: ':not([class|="rwmb"])'
ignore: ':not([class|="rwmb"])',
errorPlacement: function(error, element) {
error.appendTo( element.closest( '.rwmb-input' ) );
},
errorClass: 'rwmb-error',
errorElement: 'p'
};

// Edit post form.
Expand All @@ -33,7 +38,7 @@ jQuery( function ( $ ) {
// Required field styling
$.each( subRules.rules, function ( k, v ) {
if ( v['required'] ) {
$( '#' + k ).parent().siblings( '.rwmb-label' ).addClass( 'required' ).append( '<span>*</span>' );
$( '#' + k ).parent().siblings( '.rwmb-label' ).append( '<span class="rwmb-required">*</span>' );
}
} );
} );
Expand Down

0 comments on commit d7a5d35

Please sign in to comment.