While playing with the htmlEditor component, I found that if a page is only refreshed (like when you click on a tab of an x:panelTab), then the submitted value was lost, and replaced with the component's backing bean value.
The reason, for that is that I was using a code like this in the renderer :

String textToRender = uiComponent.getValue();

Doing this, the textToRender is always the same until the form is validated, and the Update Model Values phase is run. And any intermediary rendering will just reset the data entered by the user.
A better code would be :

String textToRender = uiComponent.getSubmittedValue()!=null ? uiComponent.getSubmittedValue() : uiComponent.getValue();

For a really correct code, look at the following helper function in :
org.apache.myfaces.renderkit.RendererUtils.getStringValue

I'm sending this email to the mailing list because it is quite easy to fall for this bug, and I think I've already found 2 places in the extensions renderers where we have this bug : in the calendar renderer, and in the date renderer.
I've marked the places in the sources where I think is the bug, but we might find other occurrences.

Sylvain.

Reply via email to