cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject cforms + htmlarea bug
Date Sat, 18 Feb 2006 22:02:53 GMT
It looks like we have a bug concerning htmlarea widget in cforms. The 
problem is following htmlarea code:

if (textarea.form) {
	// we have a form, on submit get the HTMLArea content and
	// update original textarea.
	var f = textarea.form;
	if (typeof f.onsubmit == "function") {
		var funcref = f.onsubmit;
		if (typeof f.__msh_prevOnSubmit == "undefined") {
			f.__msh_prevOnSubmit = [];
		}
		f.__msh_prevOnSubmit.push(funcref);
	}
	f.onsubmit = function() {
		editor._textArea.value = editor.getHTML();
		var a = this.__msh_prevOnSubmit;
		// call previous submit methods if they were there.
		if (typeof a != "undefined") {
			for (var i in a) {
				a[i]();
			}
		}
	};
}

which means that form's original onsubmit handler is being wrapper with 
custom htmlarea code.

Problem: the code never gets executed as the form is not invoked from

<input type="submit" name="finish" value="finish"/>

but with <input type="button" onclick="forms_submitForm( 'finish' )"/> 
(or something similar).

Result: textarea is not populated with htmlare code - you get an empty 
textarea after submit.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Mime
View raw message