WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms WYSIWYG
[resolved] Retain wysiwyg field content if form returns an error (8 posts)

  1. feurerj
    Member
    Posted 2 years ago #

    Hi,

    I'm using the wysiwyg plugin with a gravity form to allow registered users to submit guest posts to our blog.

    I turn on wysiwyg for the textarea field requesting the post content and it works well UNLESS the user tries to submit the form without completing all of the required fields.

    When that happens, gravity forms displays the default error:
    There was a problem with your submission. Errors have been highlighted below.

    The other input and textarea fields on the form retain their values and the missing field is highlighted. But the textarea field with the wysiwyg turned on loses all of its content.

    Since this is the field where I'm asking the person to input the body of their post, this is where the user would have spent most of their time inputting information and will be very discouraged to lose all that time.

    In all likelihood, they will not bother to input the content again so this is a major problem for us.

    The other major problem is that when the error message displays and the missing fields are highlighted, the wysiwyg box reverts to being a <textarea> input field and all of the editor buttons disappear.

    Can you let me know how to modify the plugin or update the form field somehow so that the field retains its content and wysiwyg status after an error is returned by gravity forms.

    Thanks very much,
    Jennifer

    http://wordpress.org/extend/plugins/gravity-forms-wysiwyg/

  2. bradvin
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Jennifer,

    I never tested validation with a WYSIWYG field, but your point is very valid and it should cater for this scenario. I will add this feature to the plugin as soon as I can.

    If in the meantime you have found a solution, by all means, please post the code here (or a link to the code)

    thanks

  3. WebEndev
    Member
    Posted 1 year ago #

    Did anyone find a solution to this?

  4. peterarends
    Member
    Posted 1 year ago #

    Is there a solutions yet? Would love to hear it.

  5. bradvin
    Member
    Plugin Author

    Posted 1 year ago #

    sorry, I have not had the time to look into this yet.

    But please feel free to contribute a solution if you solve this :)

  6. peterarends
    Member
    Posted 1 year ago #

    You are right, I really like your plugin so I should contribute. I did dive into it and was not too hard.

    Change

    wp_editor('', $input_id, $args);

    To

    wp_editor(rgpost("input_{$field['id']}"), $input_id, $args);

    It is at line 124 in the gf_wysiwyg_class.php file.

    Keep up the good work bradvin. :-)

  7. bj9545dunn
    Member
    Posted 1 year ago #

    Peter thanks for the fix listed above. It seems to work, partly.

    The text is saved, but some of the formatting becomes lost or changed. I haven't tested every type of formatting, but ordered lists and centering text do nit seem to work properly.

  8. peterarends
    Member
    Posted 1 year ago #

    You describe a different problem/bug which is that the saved input html from the wysiwyg is not displayed correctly. So the orded list is being saved and displayed, but the css is there to display it without the numbering (line 39 at gravityforms/css/admin.css).

    Try saving the wysiwyg field as a post and edit that. That works (for me).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic