Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to reset the inputfile in form after submitting the form with a file in ADF

Vidya HugarJan 21 2016 — edited Jan 28 2016

I am using oracle 12c. I have a form where i have 3 input fields and one af:inputFile where i need to upload the file and final save.

I cannot use valueChangeEvent for inputFile because if i user ResetUtils then i will not get the form input values.

On save everything works fine but when i again add a record then the last updated file still shows in inputFile(its not resetting).

After save if i set the input file binding to null then do partial trigger for the component using binding its loading the page taking huge time to save so i cant use it.

Here is my code

<af:panelFormLayout id="pfl1" rows="3">

           <af:inputText value="#{bindings.Filename.inputValue}" label="#{bindings.Filename.hints.label}"

                                    required="#{bindings.Filename.hints.mandatory}"

                                    columns="#{bindings.Filename.hints.displayWidth}"

                                    maximumLength="#{bindings.Filename.hints.precision}"

                                    shortDesc="#{bindings.Filename.hints.tooltip}" id="it9"

                                    contentStyle="width:150px" showRequired="true">

                        <f:validator binding="#{bindings.Filename.validator}"/>

                      </af:inputText>

                      <af:panelGroupLayout id="pgl350" layout="horizontal">

                        <af:inputFile label="Select" id="if51" value="#{ContractDocumentUploadDwn.file}"

                                      showRequired="true" binding="#{ContractDocumentUploadDwn.inputFileBinding}"/>

                        <af:button text="Upload" id="b353" action="#{ContractDocumentUploadDwn.uploadPortfolioDoc}"/>

                      </af:panelGroupLayout>

                    </af:panelFormLayout>

Java Code:

    public void savePortfolioDoc(ActionEvent actionEvent) {

        // Add event code here...

        DCIteratorBinding iter = getDCIteratorBinding("portfolioDocument1Iterator");

        UploadedFile myfile = (UploadedFile) this.getInputFileBinding().getValue();

        String binding = "Commit1";

        String popUpId = "p2";

        genericSaveDocuments(actionEvent, iter, myfile, binding, popUpId, "Portfolio");//Saves the document

        iter.executeQuery();

        iter.refresh(1);

        setInputFileBinding(null);

        ResetUtils.reset(actionEvent.getComponent());

    }

Please Help Me

This post has been answered by Ashish Awasthi on Jan 28 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2016
Added on Jan 21 2016
18 comments
2,786 views