Hi community,
would you mind taking a short look to the following problem, please?
Depending on the value of a checkbox I want to show either an inputText-element
or an inputTextarea-element - as shown below. The default is, that the checkbox
is disabled and therefore the inputText will be shown. If the user enters some
text to the textbox, I want to transfer it to the inputTextArea.
If I trigger some actions located on the page after text was entered and before
checkbox is clicked (communication with server took place) everything is
working fine.
If I click the checkbox right after entering the text only the changed value of
the checkbox is considered as changed (setter-method for DebitNote will not be
called) and nothing is transferred (assuming nothing was enter to the inputText
before).
What's wrong? Did I missed something? Is there any other solution you would
suggest?
//checkbox clicking on button in order to transfer state to server
<h:selectBooleanCheckbox value="#{ra.kmt}"
onclick="document.getElementById('updateButton').click();" />
//shown on startup; value should be transferred
<h:inputText value="#{ra.debitnote}" rendered="#{!ra.kmt}" size="53"
maxlength="50" tabindex="1" />
//shown if checkbox is checked; value of inputText should be displayed
<h:inputTextarea value="#{ra.debitnote}" rendered="#{ra.kmt}" rows="4"
cols="42" tabindex="1" />
//just repaint site (only transfer state to server)
<t:commandButton action="repaint" style="visibility:hidden;" forceId="true"
id="updateButton" />
Thanks alot,
Martin