Required validation not working on post_content field

Support MB Frontend Submission Required validation not working on post_content fieldResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #14845
    Ryan LauritsenRyan Lauritsen
    Participant

    I have a post_content field in a frontend form. The field is set to required using validation like the following:

    'validation' => array(
        'rules'  => array(
            'post_title' => array(
                'required'   => true,
            ),
            'post_content' => array(
                'required'   => true,
            ),
        ),
    ),

    If I try to submit the form with text in the post_content field I get the "Please correct the errors highlighted below and try again." message at the top of the form and the submit button becomes disabled.

    If I try to submit the form with the post_content field blank, validation works properly... I get the "Please correct the errors highlighted below and try again." message at the top of the form and the "This field is required." validation message below the field. The submit button is not disabled and I am able to add text to the post_content field and click submit again. However, the form does not submit. I still get the "Please correct the errors highlighted below and try again." and the submit button is disabled. (The validation message below the field is now gone).

    So it seems the validation is not completely working correctly as it always fails even if the field contains content.

    #14856
    Anh TranAnh Tran
    Keymaster

    Hi Ryan, I think the problem is the validation not working properly with wysiwyg field. I tried in the back end and see the same problem. If you switch between Visual/Text mode, then TinyMCE will update the content and set the validation properly.

    #14864
    Ryan LauritsenRyan Lauritsen
    Participant

    Thanks, Anh. I'm a little confused though. Are you saying that this is not a bug?

    We are using a WYSIWYG field in a frontend form where the Visual/Text tabs are removed via field options. And even if they were there a user would not know to switch between them to workaround this issue.

    Is there any possibility of a fix coming for this?

    #14867
    Anh TranAnh Tran
    Keymaster

    Hi Ryan, I think this is a bug with the WYSIWYG field and I'll try to fix it soon.

    #14884
    Anh TranAnh Tran
    Keymaster

    Hi Ryan, the fix is available here.

    #14917
    Ryan LauritsenRyan Lauritsen
    Participant

    Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.