You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rafa Pérez <ra...@gmail.com> on 2008/01/14 08:43:29 UTC

[TRINIDAD] How to cancel a ValueChangeEvent

Hi all,

I have a ValueChangeListener in my bean that takes the new value of an
inputText and performs a search against a database. If this search has no
results, it should display a FacesMessage and also clear the inputText. I
cannot clean the input's value or set it to its previous value. Is this
possible? Any ideas on how can I achieve this?

Any help appreciated.

Greetings,

- - Rafa

Re: [TRINIDAD] How to cancel a ValueChangeEvent

Posted by Rafa Pérez <ra...@gmail.com>.
Hi Matthias, thank you for your answer.

Yes, I did, but it seems that when the ValueChangeListener is reached, any
changes made on the component are not displayed on the browser unless the
component has a partialTrigger to itself. I have solved this issue this way,
but I am facing another problem.

A new requirement is that if the query to the database has found several
records, they show up as a popup an let the user select one of them to be
shown in the inputText. The dialog is launched programmatically inside the
ValueChangeListener, and as I need a returnListener to take the selected
value back, I have added a commandLink to define it. The piece of code is
like this:

<tr:commandLink id="enlace" returnListener="#{bean.returnMethod}" />
<tr:inputText id="cajaTexto"
                       autoSubmit="true"
                       valueChangeListener="#{bean.changeListener}"
                       partialTriggers="cajaTexto enlace"
                       value="#{bean.cajaTextoValue}"/>

And the dialog is launched by:

ViewHandler viewHandler =
FacesContext.getCurrentInstance().getApplication().getViewHandler();

UIViewRoot dialog = viewHandler.createView(facesContext, "/testPopup.jsp");
RequestContext.getCurrentInstance().launchDialog(dialog, params, enlace,
true, properties);

where enlace is the commandLink that returns a call to findComponent().

Well, everything it is ok except for the value that the inputText should
show when the popup is closed. In the returnListener, the component's value
is changed, but it is not shown on the browser. Furthermore, as the
returnListener is a property of the commandLink, no partialUpdate of the
inputText is made.

Have you any ideas on what is happening?
I do not know if this explanation of the problem is clear enough. If not,
please let me know and I will try to explain better.

Thanks in advance for any advices,

- - Rafa



On Jan 15, 2008 7:19 AM, Matthias Wessendorf <ma...@apache.org> wrote:

> have you tried the resetValue()
> (available via UIXEditableValue component)
>
> On Jan 13, 2008 11:43 PM, Rafa Pérez <ra...@gmail.com> wrote:
> > Hi all,
> >
> > I have a ValueChangeListener in my bean that takes the new value of an
> > inputText and performs a search against a database. If this search has
> no
> > results, it should display a FacesMessage and also clear the inputText.
> I
> > cannot clean the input's value or set it to its previous value. Is this
> > possible? Any ideas on how can I achieve this?
> >
> > Any help appreciated.
> >
> > Greetings,
> >
> > - - Rafa
> >
>
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> mail: matzew-at-apache-dot-org
>

Re: [TRINIDAD] How to cancel a ValueChangeEvent

Posted by Matthias Wessendorf <ma...@apache.org>.
have you tried the resetValue()
(available via UIXEditableValue component)

On Jan 13, 2008 11:43 PM, Rafa Pérez <ra...@gmail.com> wrote:
> Hi all,
>
> I have a ValueChangeListener in my bean that takes the new value of an
> inputText and performs a search against a database. If this search has no
> results, it should display a FacesMessage and also clear the inputText. I
> cannot clean the input's value or set it to its previous value. Is this
> possible? Any ideas on how can I achieve this?
>
> Any help appreciated.
>
> Greetings,
>
> - - Rafa
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org