I want to make a simple wysiwyg-textarea.
this is done by using an IFrame in design mode and copying the html from the
IFrame to a hidden field when the form is submitted.
so the html-data can be transfered to a HiddenField that is bind to the model.

that's the theory, but as a new wicket user I have problems dealing with all the
javascript/binding/form/model stuff...

so I made a little HTML-demo.
I would be very VERY thankful if anyone can implement it by using a new
component (panel?) called WysiwygTextarea(id)...
I will complete it and we can distribute it then with apache license to the
wicket-project.

ok, here is the static demo.
copy it in a file like demo.html and open it in browser.

<html>
  <head>
    <title>Wicket IFrame Submit</title>
  </head>
<body>

<form action="..." name="edit" method="POST" id="edit" onsubmit="return
submitForm();">

<iframe id="content" name="content" width="600px" height="300px"></iframe>
<input type="hidden" id="hiddencontent" name="hiddencontent" value=""/>

<input type="submit" name="Submit" value="Submit">
</form>



<script language= "JavaScript" type= "text/javascript" >
<!--
// some demo data:
var browser = navigator.userAgent.toLowerCase();
var isIE = ((browser .indexOf( "msie" ) != -1) && (browser .indexOf( "opera" )
== -1) &&    (browser .indexOf( "webtv" ) == -1));
var mainContent= "<html
id='content'><head></head><body><h1>hello</h1></body></html>" ;

var edit = document.getElementById('content').contentWindow.document;
edit.write(mainContent);
edit.designMode="On";
if(!isIE){
  document.getElementById('content').contentDocument.designMode="on";
}

function submitForm() {
  var hiddenField = document.getElementById('hiddencontent');
  if (hiddenField.value == null) hiddenField.value = "";
  hiddenField.value =
document.getElementById('content').contentWindow.document.body.innerHTML;

  alert(hiddenField.value);
  return true;
}
//-->
</script>

</body>
</html>


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to