2
votes

Is there any chance to get the html content (mime) from a rich text component without any datasource. I would like to grab the content from the field like this.
getComponent("FieldName").value
but this dosen't work.

thanks.

2
Have you tried .getValue() or .getSubmittedValue() (to catch the value once posted)?Per Henrik Lausten
No...i will try this...thank youPudelduscher

2 Answers

6
votes

You can bind the control to a scoped variable; for example, #{viewScope.comments}. You can then retrieve the submitted value from the scope instead of from the component itself; for example, viewScope.get("comments").

Alternatively, you can set a dataContext variable to a JS expression, e.g. <dataContext var="richText" value="#{javascript:return {value:""};}" />. Then you can bind the control to #{richText.value} and retrieve it via the same expression.

And, of course, you could define a managed bean and bind the control to one of its properties. This option provides the most flexibility, but isn't quite as simple as the other two options above.

0
votes

The solution for my problem is

getComponent("FieldName").getValue()

thanks for your help.