Parsing HTML Form Data back to Servoy

I am trying to integrate Tinymce within a webclient environment and have got it to work, except I dont know how to set-up the form to get the data back into Servoy:

So the basic TinyMCE example code looks like this:

globals.XTEST_CKEDITOR='<html xmlns="http://www.w3.org/1999/xhtml">\
<head>\
<title>Simple theme example</title>\
\
\
<script type="text/javascript" src="/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>\
<script type="text/javascript">\
	tinyMCE.init({\
		mode : "textareas",\
		theme : "simple"\
	});\
</script>\
\
\
</head>\
<body>\
\
<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">\
	<h3>Simple theme example</h3>\
\
	<p>\
		This page shows you the simple theme and it\'s core functionality you can extend it by changing the code use the advanced theme if you need to configure/add more buttons etc.\
		There are more examples on how to use TinyMCE in the <a href="http://tinymce.moxiecode.com/examples/">Wiki</a>.\
	</p>\
\
	\
	<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">\
		<p>\
			This is some example text that you can edit inside the <strong>TinyMCE editor</strong>.\
		</p>\
		<p>\
		Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros.\
		</p>\
	</textarea>\
\
	
\
	<input type="submit" name="save" value="Submit" />\
	<input type="reset" name="reset" value="Reset" />\
</form>\
<script type="text/javascript">\
if (document.location.protocol == \'file:\') {\
	alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");\
}\
</script>\
</body>\
</html>'

Does anyone know how I can substitute the call to the php script on the submission of the form with a call back to Servoy and pass the data held in “elm1” back into servoy?

Thanks

David

OK, I am a little closer.

I have the data in a variable.

How can i pass the variable back to a method or global method in servoy:

<SCRIPT LANGUAGE="JavaScript">\
function testResults (form) {\
    var TestVar = form.elm1.value;\
    alert ("You typed: " + TestVar);\
//Send this to a global method in my solution
????????
}\
</SCRIPT>

david, you can use the web client utils plugin for that.
http://www.servoyforge.net/projects/webclientutils

that way, you call a method in Servoy and send arguments!

Thanks Harjo,

I thought I had succeeded in doing this, but the callback method seems to be very hit and miss. I must be doing something wrong.

I am displaying the TinyMCE editor in a modal dialogue, which calls the first script on show. The callback method is on the same form, but is now not triggering.

I have a recollection that the callback did work at some point, but I can no longer even get the application output to work!
Am i doing something stupid here?

/**
 * @properties={typeid:35,uuid:"D7075E0A-3E8B-4F9E-9AE0-BAB21F542A48"}
 */
var lettername = '';

/**
 * @properties={typeid:24,uuid:"F0CFAD12-69AB-47FB-944E-68F3012BC9FD"}
 */
function createTinyMCE() {
var callback = plugins.WebClientUtils.addCallback(TinyMCE_callback, ['html']);
var script = 'function myFunction(html){'+callback+'}';

application.output(script)

globals.HTML_PAGE='<html xmlns="http://www.w3.org/1999/xhtml">\
<head>\
<title>'+lettername+'</title>\
\
\
<script type="text/javascript" src="/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>\
<script type="text/javascript">\
	tinyMCE.init({\
		mode : "textareas",\
		theme : "advanced",\
	plugins : "safari,spellchecker,pagebreak,style,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,nonbreaking,",\
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",\
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,cleanup,help,code,|,preview,|,forecolor,backcolor",\
theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap,fullscreen",\
theme_advanced_toolbar_location : "top",\
theme_advanced_toolbar_align : "left",\
theme_advanced_statusbar_location : "bottom"\
	});\
</script>\
\
<script type="text/javascript">'+script+'</script>\
</head>\
<body>\
\
<form method="post">\
	\
	<textarea id="elm1" name="elm1" rows="33" cols="100" style="width: 98%">\
'+globals.HTML_BODY+'</textarea>\
\

\
	<input type="button" name="Update" value="Update" onClick="var html=tinyMCE.get(\'elm1\').getContent();myFunction(html);"/>\
	<input type="reset" name="reset" value="Reset" />\
</form>\
\
</body>\
</html>'


}

/**
 * @properties={typeid:24,uuid:"0BC3C1BF-7ECA-4709-8358-C65D5A01E3A9"}
 */
function TinyMCE_callback(_text) {
	
application.output('-'+_text)
//globals.HTML_BODY=_text
application.closeForm('letter'); 

forms[globals.field_name].body=_text
forms.template_dtl$doc.onActionEditPreview();

}

I dont seem to get any errors in the browser, its just nothing happens when i click the update button.
my function code comes out as:

function myFunction(html){wicketShow('indicator');var wcall=wicketAjaxGet('?x=3PWDvnYHNLnyOkluCu356Lx-zfh*5Qr6tMz*pMn*nPe*GM-VoKlEdjgOiknCzWY*&m=940222235:'+html+'',function() { ;wicketHide('indicator');}.bind(this),function() { ;wicketHide('indicator');}.bind(this), function() {return true;}.bind(this));}

David