How To in Jdeveloper ADF Tutorials- reset the inputText component values


Sometimes the value of the inputText component is not refreshed and the value that was previously entered will still persist within the component. To overcome this issue. we have to use the resetValue() method to reset the component value and display the components intial state

What it does:

  • Get handle to the inputText component using the JSFUtils find component method with the inputText id passed as a parameter
  • set the submitted value of the inputText as null
  • reset’s the input component value
  • refresh the component
private void resetInputText(String id) { 
RichInputText input = (RichInputText)JSFUtils.findComponentInRoot(id); 
input.setSubmittedValue(null); 
input.resetValue(); 
AdfFacesContext.getCurrentInstance().addPartialTarget(input); 
}

Usage:

This method is used to reset the inputText component value’s in a popup, af:formlayout, af:table.

19 thoughts on “How To in Jdeveloper ADF Tutorials- reset the inputText component values

  1. Anonymous

    I have got the same problem with my form. One of the fields is not refreshed. I don’t have idea why. But your code solves the effect not the cause of the problem. I think it may be connected somehow with partial triggers (but only declarative in JSFF, not triggered through java code). I’ll try to dig through the problem to find the cause.

    Reply
  2. Kamil

    I have got two fields, one is refreshed, the second is not. I have compared each layer, starting from entity level, VO, definition in binding container, usages in backing bean and i do not see many differeneces. If there was any, i tried to copy settings to check result and still nothing. In my opinion the problem is in the view layer. The field starts to being refreshed properly after setting readOnly attribute to true (or change inputText to outputText). Have you tried to change values of view layer attributes of the field or parent container (ie. clientComponent, refreshCondition, autoSubmit, ??)?

    Reply
    1. Massimo

      Hi all,I created a pecjrot with fod, created a database connection, the entities from the tables and the view objects. I’m trying to run the modue and it always give me the message :(oracle.jbo.ConfigException) JBO-33003: Connection name fod not definedi have done the following steps1. Expand the Application Resources accordion, then the Connections folder and the Database node.2. Does the Database node contain a node for your connection?3. Right-click the node for your connection and select Properties in the context menu.4. In the Edit Database Connection dialog, click Test Connection. Is the test successful?5. In the navigator, double-click your business components pecjrot to edit it. 6. In the Project Properties dialog, go to the Business Components page. 7. Is there a connection selected, and is it the same connection that you tested in step 4?8. Click the pencil icon to edit the connection, and click the Test Connection button. Is the test successful?it is successfull but when iam trying to run the module it is giving the same errro.what would be proble plz help methnx.

      Reply
    2. Mariana

      Hi Andrejus,I run your sample apocilatipn in JDeveloper 11.1.2.3.0. And I got message: ” The region component with id: r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.”Is it safe?Thanks.

      Reply
  3. Rohit

    This solved the problem I was facing (programmatically resetting the input text upon tab disclosure).
    Thanks a ton!!

    Reply
    1. Kamil

      It solves my problem either but it says nothing about the cause. How can i be sure that i have got a problem only with one ui control and not with million others? Knowing the cause allows you to solve the problem before it occures somewhere in the application.

      Reply
  4. Mrigendra Singh

    When you are trying to solve a problem for couple of weeks, you don’t really care what the real problem is when you find a solution. Thanks for the solution vtKrishn.
    My application uses Steven Develaar’s Dynamic regions tabs based on dynamic tabs created at run time in Jdev 12c. And I use Context event to pass values from one region to another. I could only get the dropdown to refresh (after setting value through event handler), using resetValue method.

    Reply
    1. Kamil

      @Mrigendra Singh, i don’t agree. For instance if you have a bug in your util bean or you have bad habit doing something the cause may be not one instance problem but a common problem in whole application. You event won’t be able to trace it.

      Once i’ve done HR schema based proof-of-concept to check something else and this bug/feature occured there. It looks like it is somehow related with adf phases (jsf phases), when you switch/skip some of them.

      Reply
      1. Mrigendra Singh

        True!! The right way is to know the real cause. But I have checked this on very basic application (i.e. no VOs etc) and I did not get any good solution from OTN either. So for now above is the only solution there that I can see.

      2. Kamil

        Try to mix autosubmit and immediate properties on text field and field.setvalue(“new value”); facescontext.renderresponse methods under a button. IMO re-setting ui field value is within one of omitted phase.

  5. Umer

    hi,
    I want to refresh(update few fields) on my parent form when OK button is clicked on Poup Dialog. But it does not refresh the fields. I have also set partialTriggers for the fields with Popup Id.
    My Jdeveloper version is 11.1.1.7

    Thanks

    Umer Farooq

    Reply
  6. Ayushi

    Hi,

    I have got one more solution. In my case I wanted to set the value to something else so for that I have given Immediate=”true” in the properties of input text.

    Reply
    1. Kamil

      @Ayushi
      As i said before, it has something to do with JSF lifecycle. When you set immediate to true you’re skipping i.e. “update model values” phase. But still i haven’t found in the documentation the reason of such behavior 🙂

      Reply
  7. Anonymous

    Thanks much, Very helped, solved my issue, otherwise I was thinking, it was a weird caching issue.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s