Cerealkillerway / materialNote

Summernote wysiwyg editor converted for Materialize
MIT License
109 stars 44 forks source link

Dropdown menus submit form #18

Open diegonc opened 8 years ago

diegonc commented 8 years ago

Dropdown menus in the toolbar are implemented as button tags but have no type property. The default value for that property is submit which means each time one toolbar menu is opened the form containing the materialnote editor is submitted.

Please add type="button" to the attribute list of buttons. Otherwise, the editor is not very useful when insede a form element.

I'm working with the Meteor package, inside an autoform form, but that should not be relevant.

AbdelMounhim commented 8 years ago

Hi,

workaround for me (prevent every dropdown to submit)

in the Template.xxx.onRendered : // all i are buttons ... $("i").attr("type", "button").click(function(e) { e.preventDefault() });

and in Template.xxx.events :

'click .note-editor * ' : function(e) { e.preventDefault() ; return ; }

diegonc commented 8 years ago

AbdelMounhim, the type attribute makes no sense in the context of i HTML elements.

What I temporarily did is:

$(".note-editor")
  .find("button")
  .attr("type", "button");
Dmitrev commented 7 years ago

@diegonc Thanks, this workaround works great for the time being.

AbdelMounhim commented 7 years ago

yes. thanks @diegonc for your workaround.

M-Blobby commented 7 years ago

Same problem. Thank you @diegonc , your solution works like a charm.

sergiocasao commented 7 years ago

Lot of thanks @diegonc !