Forum Stats

  • 3,851,507 Users
  • 2,263,992 Discussions


af:inputfile in column of af:table

User_Q9C3J Member Posts: 16 Green Ribbon


I am building an adf app in JDev Studio Edition

I found this post valueChangeListener of inputFile doesnot work for first click — oracle-tech that describes what I am trying to accomplish but no real answer was found it seems.

I have a table (single-select) with a column with af:inputFile in this column. The valueChangeListener does not fire on the first click of the upload file button on a row which is not currently selected.

Example: on page load, row one is selected. User doesn't select another row, but rather just selects the af:inputfile button on let's say row 2 column 4 (the column with the input file). The valueChangeListener does not get called. If the user was to first select row 2 by clicking anywhere on this row, and THEN the user clicks the upload button, the listener would get called.

Is there a way to make the listener get called without first selecting the row but just selecting the upload button in that row?

By the way, this would work correctly if RowSelection="false" but it fails when RowSelection="single" and I need the rows to be selectable.

Thanks in advance.



  • dvohra21
    dvohra21 Member Posts: 14,660 Gold Crown

    Render the input file component through a separate command link instead of selecting a row. Answer taken from another post "How to add af:inputFile dynamically within each row of table?":

    - add an af:inputFile to the column and set its rendered property to point to a managed bean property. The managed bean property has a default value of "false" and the bean should be in viewScope

    - create another variable that holds the row number that should show the inputFile component. This is updated by the command link and evaluated by the get method of the managed bean property controlling the inputFile visibility

    - Define a property name for the table varStatus property

    - For the command link, define a attribute f:attribute with the name rowNumber and set its value to #{varStatusPropertyName.index}

    - define an action listener for the command link

    public void showInputFile(ActionEvent actionEvent){

    int rowNumber = ((RichCommandLink) actionEvent.getSource()).getAttributes().get("varStatusPropertyName");

    //set the value on the internal variable



    - In the getter of the property that defines the render value of the inputFile, use code like this

    public boolean get<whatever name you use>(){

    //access the following EL from Java #{varStatusPropertyName.index}

    int currentRenderedRow = <EL result here>;

    // compare the current row index with the one set by the command link, which is stored in the variable of the managed bean


    if true return true

    else return false


    - Set the PartialTriggers property of the table to point to the commandLink ID so the table is repainted when the command link is pressed

    This should then render the fileInput component for a single row (the one you clicked the command link in)

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,725 Red Diamond

    @User_Q9C3J it would help if we could see how the table and the columns are set up. Even better, you could provide a reproducible test case (see so that we can take a look.

    The thread you mentioned is for an older version and things might have changed.

    For reference: the thread @dvohra21 mentioned is It's for another too.


  • User_Q9C3J
    User_Q9C3J Member Posts: 16 Green Ribbon

    Hi, thank you both so much for your help. Attached here is a zip archive. Run home.jsf and:

    1. on page load, select choose file in top row and choose a random file on your machine.
    2. Notice in the jdev console "event fired." prints from the TableBugBean.
    3. Next, click choose file in the second row without clicking anywhere else and choose a file.
    4. Notice the "event fired." text does not print. Notice this row still says "no file chosen"
    5. Do this same thing again on row two and notice the event fired text print.

    I want to know how to make the event fired text print in step 4, so step 5 is not necessary.

  • dvohra21
    dvohra21 Member Posts: 14,660 Gold Crown

    Why is choosing a row prior to uploading a file not suitable? May be a different fix exists.