Closed sjregan closed 2 years ago
It's because you're not using a validation that interfaces with the core validation functions, and why the JS isn't handling it.
The validation system works fine if the field type is not 'ace_editor'.
Regardless, I have updated the ticket to remove the issue being related to custom validation. Here is some sample code:
Redux::set_section( $opt_name, array(
'title' => esc_html__( 'Basic Field', 'your-textdomain-here' ),
'id' => 'basic',
'desc' => esc_html__( 'Basic field with no subsections.', 'your-textdomain-here' ),
'icon' => 'el el-home',
'fields' => array(
array(
'id' => 'opt-text',
'type' => 'ace_editor',
'title' => esc_html__( 'Example Text', 'your-textdomain-here' ),
'desc' => esc_html__( 'Example description.', 'your-textdomain-here' ),
'subtitle' => esc_html__( 'Example subtitle.', 'your-textdomain-here' ),
'hint' => array(
'content' => 'This is a <b>hint</b> tool-tip for the text field.<br/><br/>Add any HTML based text you like here.',
),
'validate' => 'email',
'default' => 'notanemail',
)
)
) );
And a video showing the issue.
https://user-images.githubusercontent.com/1580170/177735206-38d58c18-ab90-41f3-882e-e2aa45ef8ce7.mov
I'll try to take a look at it later this week.
That should do it.
Great job, thank you.
Site Health Report
Steps to reproduce
Expected Behavior
The validation error message to be removed.
Actual Behavior
The validation error message remains on screen even though the field has passed validation and been saved.
Any Error Details (PHP/JavaScript)
Note: This is a Javascript bug, not PHP.
I believe it is because the Javascript does not handle the additional
<div class="ace-wrapper">
element when using a field type oface_editor
.Modifications to sample config:
Validation function: