[SHORT VERSION EXPLANATION] : I'm having problems updating some inputText
values after a file upload. It's not working if ANY other inputText
element has been filled before the upload.
[LONG VERSION] : I need help understanding the reason why after uploading a file that changes the inputText
fields values (in the managedBean), the inputText
fields don't assume their new values after their element has been updated.
The page is made of a Form, containing 2 fragments:
What I found:
FileUpload
successfully changes updates the managedbeans variables values (category.setName() and category.setValue() is triggered after uploading the file). update="fileUploadField inputTextFields"
is working (getters are called and the fields are disabled after the file has been uploaded) NOTE: The inputText_B and _C need to be inputTexts, because the user should be allowed to input the info manually in case he doesn't have the necessary file.
fields.xhtml
<p:fieldset id="inputTextFields" toggleable="true" toggleSpeed="150"
<p:inputText id="inputText_A"
value="#{uploaded.category.serial}"
disabled="#{details.disabled()}"
required="true"
requiredMessage="#{msg['uploaded.category.serial.empty']}"
onblur="deactivateCategoryListOrButton(); setChanged()">
</p:inputText>
<p:inputTextarea id="inputText_B"
value="#{uploaded.category.name}"
disabled="#{details.disabled()}"
required="true"
requiredMessage="#{msg['uploaded.category.name.empty']}"
autoResize="false" rows="4"
valueChangeListener="#{uploaded.fieldListener}"
onblur="deactivateCategoryListOrButton(); setChanged()">
</p:inputTextarea>
<p:inputTextarea id="inputText_C"
value="#{uploaded.category.value}"
disabled="#{details.disabled()}"
required="true"
requiredMessage="#{msg['uploaded.category.name.empty']}"
valueChangeListener="#{uploaded.fieldListener}"
onblur="deactivateCategoryListOrButton(); setChanged()">
</p:inputText>
</p:fieldset>
uploader.xhtml
<p:fieldset id="fileUploadField" toggleable="true" toggleSpeed="150"
<h:panelGroup>
<p:fileUpload id="#{details.fileUploadCompIdRule}"
fileUploadListener="#{details.handleFileUpload}"
mode="advanced" allowTypes="/(\.|\/)(xml)$/"
label="#{msg['uploaded.category.button.browse']}"
multiple="false" auto="true"
update="fileUploadField inputTextFields"
disabled="#{details.categoryActive()}"
oncomplete="deactivateCategoryListOrButton(); setChanged()" />
</h:panelGroup>
</p:fieldset>
Thanks in advance! RMG
UPDATE:
The problem persists but I've created in the form
, after the fragment
, 2 inputHidden
fields with same value="#{uploaded.category.Name}"
. The inputHidden
values are updated with the values of the uploaded file (as it was supposed to happen in the inputText
fields too).
Any idea why that's working in the inputHidden
but not in the inputText
fields?
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.