This discussion is archived
9 Replies Latest reply: May 1, 2012 10:18 AM by 761373 RSS

af:inputText  and bad autoSubmit

761373 Newbie
Currently Being Moderated
Hello.

I am using ADF 11.1.1.3 and find strange thing in PPR:

-------
<af:goButton text="Сформировать Excel" id="gb1"
destination="/report.xls?param6=#{viewScope.QuarterReportBean.sendCode}"
partialTriggers="it1"/>


<af:inputText label="Код посылки" id="it1" visible="#{(viewScope.QuarterReportBean.useSendCode) ? true : false}"
inlineStyle="font-weight:bold;"
value="#{viewScope.QuarterReportBean.sendCode}"
autoSubmit="true" immediate="true" autoTab="true">
</af:inputText>
--------

When i write something in inputText and then click goBuuton first time autosubmit will happen. When i click second time link will work fine. If i change a text into inputText and press goButton i will get previous link.

Why it works so strange?
What can i do? Maybe client listener will help me? Any ideas? Any examples?

P.S.:
In addition which is a best way to make InputText only available for inserting numbers?
  • 1. Re: af:inputText  and bad autoSubmit
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    how do you get back tho the page. The goLink redirects the request to another page showing a report. So how do you get back to this page?

    Frank
  • 2. Re: af:inputText  and bad autoSubmit
    761373 Newbie
    Currently Being Moderated
    No way back.

    goButton is going to Servlet with doGET method that returns a report.

    May be i need to make an Event listener and refresh goButton through programming code?
  • 3. Re: af:inputText  and bad autoSubmit
    761373 Newbie
    Currently Being Moderated
    Problem is still actual.


    Programming PPR in managedBean did not help:
    public void textTyped(ValueChangeEvent valueChangeEvent) {  
    AdfFacesContext.getCurrentInstance().addPartialTarget(goButton1);
    }
  • 4. Re: af:inputText  and bad autoSubmit
    SantoshVaza Expert
    Currently Being Moderated
    remove immediate="true",
    adding it wont update your model property...
    still if you want to add it then handle valuechangelistener of imputtext manually, and update your model property there.. like
    propertyName=valuechangeevent.getNewValue();

    hope this helps..
  • 5. Re: af:inputText  and bad autoSubmit
    761373 Newbie
    Currently Being Moderated
    Sorry, but i don't understant you fully.

    I have removed immediate="true" but it is still work bad.

    Any ideas?
  • 6. Re: af:inputText  and bad autoSubmit
    SantoshVaza Expert
    Currently Being Moderated
    probabaly this should work... after removing immediate=true...
    am too confused..

    edit::
    perhaps you should read what documentation of af:goLink says
    http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_goLink.html

    alternative workaround is to create binding of af:goLink and handle valueChangeListener of inputText and manually set the destination of af:goLink in vce

    hope this helps

    Edited by: Santosh Vaza on May 1, 2012 8:53 PM
  • 7. Re: af:inputText  and bad autoSubmit
    761373 Newbie
    Currently Being Moderated
    Sorry, but doesn't work too.

    I think problem are in ADF Controller or in something like this, because if Browser losts focus or af:InputText losts focus or you press "Enter" when focus is set on af:InputText you will always get changeEvent and destination will be changed. I think that i need to call the same event from javaScript. But there is a question HOW?

    Edited by: Alexys on 01.05.2012 9:03
  • 8. Re: af:inputText  and bad autoSubmit
    SantoshVaza Expert
    Currently Being Moderated
    have you read the doc.. what does it says...?

    pls gothrough my previous post properly...
  • 9. Re: af:inputText  and bad autoSubmit
    761373 Newbie
    Currently Being Moderated
    alternative workaround is to create binding of af:goLink and handle valueChangeListener of inputText and manually set the destination of af:goLink in vce
    <af:goButton text="goButton 1" id="gb1" destination="/ttt?par1=#{pageFlowScope.SampleTF1Param1}"
    binding="#{backingBeanScope.managedBe.clickButt}"/>
    <af:inputText label="Label 1" id="it1" value="#{backingBeanScope.managedBe.text}" columns="50" autoSubmit="true"
    valueChangeListener="#{backingBeanScope.managedBe.valueChange}" clientComponent="true"/>


    And BackingBean:

    private String text;
    private String propName;
    private RichGoButton clickButt;

    public void setText(String text) {
    this.text = text;
    }

    public String getText() {
    return text;
    }

    public void valueChange(ValueChangeEvent valueChangeEvent) {
    propName = valueChangeEvent.getNewValue().toString();
    System.out.println(propName);
    clickButt.setDestination("/ttt?par1=HELLO&par2="+propName);
    clickButt.setText(propName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(clickButt);
    }

    public void setPropName(String propName) {
    this.propName = propName;
    }

    public String getPropName() {
    return propName;
    }

    public void setClickButt(RichGoButton clickButt) {
    this.clickButt = clickButt;
    }

    public RichGoButton getClickButt() {
    return clickButt;
    }


    Am i wrong with my code?


    I read the doc too and i says that only 1 way is using binding. Am i wrong too?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points