[opencms-dev] CmsHtmlWidget request type of setter

Mark Lange mark at marlan.info
Fri Oct 10 18:56:14 CEST 2008


Hi,
I solved my problem with overwriting (in my subclass) the function
org.opencms.workplace.CmsWidgetDialog#defaultActionHtmlContent()
Iirc there was a problem with a missing javascript function call.
This is not the optimal solution, but maybe it helps until there is a real
fix:

/**
  * Returns the html code for the default action content.
  * <p>
  * FIXME: where is the right place to invoke the submit(theForm) for the
  * html editors
  * 
  * @return html code
  */
 protected String defaultActionHtmlContent() {

  StringBuffer result = new StringBuffer(2048);
  result.append("<script type=\"text/javascript\">\n<!--\n");
  result.append("function prepareSubmitAction(actionValue, theForm,
formName){\n");
  result.append("\tif (theForm == null) {\n");
  result.append("\t\ttheForm = document.forms[formName];\n");
  result.append("\t}\n");
  result.append("submit(theForm);\n");
  result.append("return submitAction(actionValue, theForm, formName);\n");
  result.append("}\n-->\n</script>\n");
  result.append("<form name=\"EDITOR\" id=\"EDITOR\" method=\"post\"
action=\"")
  .append(getDialogRealUri());
  result.append("\" class=\"nomargin\" onsubmit=\"return
prepareSubmitAction('")
  .append(DIALOG_OK).append("', null, 'EDITOR');\">\n");
  result.append(dialogContentStart(null));
  result.append(buildDialogForm());
  result.append(dialogContentEnd());
  result.append(dialogButtonsCustom());
  result.append(paramsAsHidden());
  if (getParamFramename() == null) {
   result.append("\n<input type=\"hidden\" name=\"").append(
     PARAM_FRAMENAME).append("\" value=\"\">\n");
  }
  result.append("</form>\n");
  result.append(getWidgetHtmlEnd());
  return result.toString();
 }
cu mark

Kunicke, Holger wrote:
> 
> I have built a class by extending CmsWidgetDialog. I define fields in
> defineWidgets() method, and everything works fine. In actionCommit()
> method I receive values from fields. That fields are defined as
> CmsInputWidget and CmsTextareaWidget. However, now I need to add a
> CmsHtmlWidget and this doesn't work. After the form submit, in
> actionCommit() I don't receive any value from this field, it is empty. 
> 
> 

-- 
View this message in context: http://www.nabble.com/CmsHtmlWidget-request-tp8051685p19922081.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list