Custom Fields
Re-Envisioned
Support MB Frontend Submission Required validation not working on post_content field

This topic contains 5 replies, has 2 voices, and was last updated by  Ryan Lauritsen 5 months ago.

  • Creator
    Topic
  • #14845
    Resolved
    Ryan 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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #14856

    Anh 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 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 Tran
    Keymaster

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

    #14884

    Anh Tran
    Keymaster

    Hi Ryan, the fix is available here.

    #14917

    Ryan Lauritsen
    Participant

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.