Skip to content

Commit

Permalink
GFCV-89 Make gform_counter_script copy actually readable
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-fj authored and agileware-dev committed Jul 3, 2024
1 parent 58f09d7 commit fa62561
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions gf-civicrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,18 @@ function set_text_input_counter( $script, $form_id, $input_id, $max_length, $fie
$max_length = 255;
}

$script =
"if(!jQuery('#{$input_id}+.ginput_counter').length){jQuery('#{$input_id}').textareaCount(" .
" {'maxCharacterSize': {$max_length}," .
" 'originalStyle': 'ginput_counter gfield_description'," .
" 'displayFormat' : '#input " . esc_js( __( 'of', 'gravityforms' ) ) . ' #max ' . esc_js( __( 'max characters', 'gravityforms' ) ) . "'" .
" });" . "jQuery('#{$input_id}').next('.ginput_counter').attr('aria-live','polite');}";
$displayFormat = esc_js( __( '#input of #max max characters', 'gravityforms' ) );

$script = <<<EOJS
if(!jQuery('#{$input_id}+.ginput_counter').length){
jQuery('#{$input_id}').textareaCount({
'maxCharacterSize': {$max_length},
'originalStyle': 'ginput_counter gfield_description',
'displayFormat' : '{$displayFormat}'
});
jQuery('#{$input_id}').next('.ginput_counter').attr('aria-live','polite');
};
EOJS;
return $script;
}

Expand Down

0 comments on commit fa62561

Please sign in to comment.