Forum closed. New forum available at

Multiple submit buttons?

Support forum for WYMeditor.

Multiple submit buttons?

Postby michaele on Mon Oct 13, 2008 11:02 pm

I am using wymeditor in a CMS that is based on jQuery.

This code sets up wymeditor on any textarea with the class "richtextarea"

updateSelector: "#submitbutton, #submittomail",
updateEvent: "click"

In theory, this should cause both the submitbutton and the submittomail button to update wymeditor and submit the form.
However, in this usage, only the first one, submitbutton, does what it should.

The difference is that 'submitbutton' is a "submit" input type, while 'submittoemail' is a "button" input type, with the submission action for the form added via jquery.

// other stuff here

This seems to cause the form to be submitted before the wymeditor source is updated.
If I change it to a "submit" type , it updates wymeditor as it should, before submitting the form.
But then I have another problem, clicking 'enter' in any field causes the second submit button to be clicked - it should use the current 'submit' button.
This is why I have the other button as a 'button' with the submit added dynamically.

So I either need to force wymeditor to accept the 'button' as an update handler, or add some code before the 'submit()' for the click function, that updates wymeditor then submits the form.

I am open to any change that will make this work the way I need... any ideas?
Posts: 3
Joined: Mon Oct 13, 2008 9:00 pm

Re: Multiple submit buttons?

Postby mr_lundis on Wed Oct 15, 2008 5:46 pm

Hi Michaele, and welcome to the WYMeditor forum!

First of all I'm sorry for the late response. I've however done some thinking, and I can't find any obvious mistakes or errors in your submitted code. Is it possible that you could set up a test page for us? That would make it a lot easier to find the cause of you problems.

Thanks. ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: Multiple submit buttons?

Postby jfh on Thu Oct 16, 2008 6:09 pm

If you know the WYMeditor instance index (usually 0, if there's just one instance in the page), you can use the update() API call like this:
Code: Select all

jQuery.wymeditors examples are available in the Test Suite HTML source.
User avatar
Site Admin
Posts: 370
Joined: Sat Sep 23, 2006 8:43 pm
Location: Belgium

Re: Multiple submit buttons?

Postby michaele on Thu Oct 23, 2008 8:12 am

@jfh: Thanks SO much - that did the trick perfectly!

>> jQuery.wymeditors(0).update();
or $.wymeditors(0).update();

this does exactly what I needed.

Curious, is there a way to use that same method on multiple wym's ?

( Could you first check the DOM for the number of instances, then loop through and update each by number?
Or maybe a more elegant way?)

thanks for the help, really a time saver.
Posts: 3
Joined: Mon Oct 13, 2008 9:00 pm

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest