Hi @wilfredw92
I hope you’re well today!
That’s due to how repeater works and the fact that JS won’t be applied to directly (unless it would be significantly expanded/changed) after the form is already rendered, to the elements that are “injected”.
But we can use a different method which would be a combination of CSS (to handle front-end display) and PHP (to handle submission data).
You’d need to remove solution that you added entirely first and then add this code as MU plugin to the site:
<?php
// set upper-case display on front
add_action( 'wp_footer', 'forminator_uppercase_text_style', 99 );
function forminator_uppercase_text_style() {
?>
<style>
.forminator-field-text input {
text-transform:uppercase;
}
</style>
<?php
}
// convert for submission
add_filter( 'forminator_field_text_sanitize', 'forminator_uppercase_text_submit', 11, 2 );
function forminator_uppercase_text_submit( $data, $field ) {
if ( $field['type'] == "text" ) {
$data = strtoupper( $data );
}
return $data;
}
Here’s how to add it:
1. create an empty file with a .php extension (e.g. “forminator-uppercase-text-fields.php”) in the “/wp-content/mu-plugins” folder of your site’s WordPress install
2. copy above code and paste it into that file
3. save the file.
This will work regardless of whether form is loaded using AJAX or no-AJAX and will handle all the text (“input” type) fields on the form – including paged forms and repeaters.
The only “catch” here is it will apply to all the forms on site. If you want to make it limited to specific forms, let us know.
Kind regards,
Adam