Summernote: Textareas do not clear on form reset

I have an input form that I converted Medium editors to Summernote. They work perfectly except that on success I have it set up to reset the form. The whole form resets except the Summernote textareas.

Still waiting for the Summernote Word cleaning tools as well :wink:

Yes, I have exactly the same problemā€¦

It seems like if the summernote text area has some existing text in it and then the next dmx-bind:value to be loaded has a value of "" then this isnā€™t loaded into the textarea and the previous text is left behindā€¦

ā€¦ so on my form the old value gets written into the newly viewed table row if my user clicks on save.

There is no way I can use Summernote in my design until this is fixedā€¦

Is anyone else finding this is an issue?

1 Like

You need to reset Summernote as well as the form as in:

<form id="form1" method="post" is="dmx-serverconnect-form" action="dmxConnect/api/frmContact.php" dmx-on:success="form1.reset();comment.reset()"

Thanks for that Ben!

So what is "comment"? Do I just put comment.reset() or do I substitute comment for something else?

What if I have multiple Summernote textareas on the page?

Iā€™m also getting console errorsā€¦

summer

These errors occur some of the times when I load my form with some new dataā€¦

Here is my textarea codeā€¦

<textarea id="i_location_description_html" name="location_description_html" type="text" class="form-control input_text" dmx-bind:rows="40" dmx-bind:value="location.data.location.location_description_html"
							dmx-bind:disabled="view_edit_mode.value=='view'" dmx-bind:rows="40" dmx-on:keypress="autosave_location.start()" is="dmx-summernote"
							dmx-bind:toolbar="[['font',['bold','underline','clear']],['color',['color']],['para',['ul','ol','paragraph']],['insert',['link','picture']],['view',['fullscreen']]]"></textarea>

Am using Wappler 3.0.1

It is the ID of the Summernote element

Each Summernote will have a different ID

1 Like

we had similar problem.

as suggested by @ben we had to specifically reset the summernote element after the form reset by doing a summernoteElementID.reset()

1 Like

Executing the input_textarea.reset() hasnā€™t fixed it. :frowning:

When input_textarea.reset() is executed, the textarea clears visually, but not internally. By this I mean that what the user sees is an empty textarea, but when the form is submitted, the textarea actually still contains the old value.

When input_textarea.reset() is executed, there is this message in the console:

summer

Hi @Antony, have you wondered why 3 Summernote objects have loaded correctly and the 4th is showing an error? In case that I am miss-interpreting the console message, could you supply more info?

Hi Benā€¦ Thanks for that thoughtā€¦ it has prompted some more investigation.

  • I only have one summernote textarea in my design.
  • The ā€œinit summernoteā€ message happens each time I reset the form and do a server connect which causes a text value which is more than an empty string to be loaded into the summernote textarea.
  • The Error message happens each time I reset the form and do a server connect which causes a text value of "" (empty string, rather than null) to be loaded into the summernote textarea when the previous value stored in the textarea was a non empty string. So in this case, the summernote text area clears visually but still internally contains the text from the previous record I was viewing.

@patrick, Iā€™m thinking I will need your support in this! :slight_smile:

Thanks for your support thus far, Ben!
Antony.

Select the form
Dynamic Events > Action > Find the Summernote Textarea > Select Empty > Click +
See image below. You may also use ā€œResetā€

Oh, thanks for that @web-works!

I would have expected .reset() to do a .empty() tooā€¦ but clearly it doesnā€™t right now and there is some bug going on for me to be getting the console error!

Reset returns the initial value of a form input. If your input had some predefined/dynamic value set on load, reset wi revert it to this value.

Thanks for that input Teodor, that really helps!

So the textarea is set to have the value:

dmx-bind:value="location.data.location.location_description_html"

So when I re-load the location server connect, I would expect the textarea to correctly contain the new value of location.data.location.location_description_html without needing to do a .reset() or .empty() on the textarea first. Is that correct @Teodor?