Jeff, maybe this will save you a little bit of effort.

>From http://issues.apache.org/jira/browse/MYFACES-749
=========================================
The answer (which I will also post to that thread) is that renderers
for EditableValueHolders (and everything that inherits from UIInput is
an EVH) render the submittedValue of the component if that value is
not null.

The submitted value is only set to null if the component successfully
validates.   By marking your pulldown component as immediate, then
short-circuiting the process by calling renderResponse(), you force
the inputText component to always render the submitted value.

So you need to not only update the backing bean, but also the
submittedValue for the backing bean.   However, it might be sufficient
to just set the submittedValue of the dependent component (inputText
in this case) to null, which will probably force the inputText
component to render the value from the backing bean.   But it might
render the local value of the component instead -- I really don't
know.   But in any case, you have to change the submittedValue of the
dependent component.
=========================================


On 10/26/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
> Yeah, I know exactly what you're trying to do -- I do the same thing.
>
> I think you can make this work using immediate if you have only one of
> these kinds of fields, but it's going to be painful.
>
> If you're going to have more than one, you'll need something like the
> OptionalValidationFramework, otherwise your multiple immediate fields
> will conflict.
>
> Assuming it's just one, do this.  Set immediate on the UIInput field
> but not on the dependent fields.  At this point you know that the
> UIInput has valid input, but no validation or model updates have
> occurred for other components or backing beans.   So changing them is
> likely to be overwritten during process validations unless you
> short-circuit the process, which I think you're doing with
> renderResponse.
>
> You'll definitely want to grab the bean using createValueBinding()
> rather than creating it from scratch.   I think at that point, simply
> updating the bean should be sufficient, but you could take the shotgun
> approach and update the dependent component's submitted value
> (setSubmittedValue()) and local value (setValue()) if you wanted to be
> sure.
>
> I'm using the OptionalValidationFramework, so I can't say for sure
> whether setting the bean is sufficient.  You'd have to take a look at
> the renderer for the dependent component and determine if it grabs the
> value from the bean even when the component didn't get validated, or
> if it falls back to the submitted value or local value.
>
> On 10/26/05, Jeffrey Porter <[EMAIL PROTECTED]> wrote:
> > Yep that's it.
> >
> > I'm trying to have a page with a bunch of text fields on it.
> > When one of those fields is filled in, and action or an
> > valueChangeListener gets called, which allows me to fill in some of the
> > other fields based on the first.
> >
> > For example...
> >
> > User fills in the field "Part Number",
> > The Fields "Part Description" & "Part Manufacture" then gets
> > automatically filled in.
> >
> > Thanks for taking the time to respond. Being the only developer on this
> > is doing my head in.
> >
> > :-)
> >
> > Jeff
> >
> >
> >
> >
> > -----Original Message-----
> > From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> > Sent: 26 October 2005 18:52
> > To: MyFaces Discussion
> > Subject: Re: Help still needed with valueChangeListener
> >
> > Jeff,
> >
> > Can you restate what you're trying to accomplish.  The more I read
> > this thread, the less I'm sure I understand.  :)
> >
> > My understanding is that you want to do this:
> >
> > 1) display a page
> > 2) change an Input component to a new value without triggering any
> > other validation, model updates, or actions.
> > 3) redisplay the page with other dependent components updated based on
> > the value of the Input component.
> >
> >
> > On 10/26/05, Jeffrey Porter <[EMAIL PROTECTED]> wrote:
> > > Hi Mike,
> > >
> > > I've tried that.
> > >
> > > I've tried getting both the bean & the Manager class, but setting the
> > > values either or them doesn't work. :-(
> > >
> > >
> > > The new code is at...
> > >
> > http://www.jeffreyporter.pwp.blueyonder.co.uk/ebusiness_LISTENER_PROB2.e
> > > ar
> > >
> > > The Code is at...
> > >
> > http://www.jeffreyporter.pwp.blueyonder.co.uk/NonConformingMaterialManag
> > > er.java
> > >
> > > The JSP is at...
> > > http://www.jeffreyporter.pwp.blueyonder.co.uk/theTest.jsp
> > >
> > >
> > > Jeff.
> > >
> > >
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> > > Sent: 26 October 2005 17:45
> > > To: MyFaces Discussion
> > > Subject: Re: Help still needed with valueChangeListener
> > >
> > > It's hard to tell with only bits and pieces of the source code, but
> > > maybe the bean you're creating in the value listener isn't the same as
> > > the managed bean?
> > >
> > > Maybe do something like the following in your value listener instead
> > > of "Bean bean = new Bean()".
> > >
> > >         ValueBinding binding =
> > >
> > FacesContext.getCurrentInstance().getApplication().createValueBinding("#
> > > {bean}");
> > >         org.iarc.ebusiness.model.Bean bean=
> > >
> > (org.iarc.ebusiness.model.Bean)binding.getValue(FacesContext.getCurrentI
> > > nstance());
> > >
> > >
> > > On 10/26/05, Jeffrey Porter <[EMAIL PROTECTED]>
> > wrote:
> > > >
> > > > Sorry Volker, I uploaded the wrong file.
> > > >
> > > > Uploaded the working one now. Sorry.
> > > >
> > > >
> > > > Mike,
> > > >
> > > > The page does sort of explain some of the problems I'm having.
> > > > The limitations section talks about how you should not use the
> > > > "immediate" attributes on anything other than a cancel button. But
> > I'm
> > > > using this value get the valueChangeListener attribute to be
> > executed
> > > > before the rest of the page is filled in.
> > > >
> > > > I'm now a little lost on where to go.
> > > >
> > > >
> > > > My original problem still remains...
> > > >
> > > > I want to fill in a text field and then have other text fields
> > filled
> > > in
> > > > automatically from Manager class (look up values from another
> > system).
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Volker Weber [mailto:[EMAIL PROTECTED]
> > > > Sent: 26 October 2005 17:13
> > > > To: MyFaces Discussion
> > > > Subject: Re: Help still needed with valueChangeListener
> > > >
> > > > I can't deploy the contained war. i got a
> > > > ClassNotFoundException:
> > > > org.apache.myfaces.examples.servlet.SourceCodeServlet
> > > >
> > > >
> > > >
> > > > Jeffrey Porter wrote:
> > > > >
> > > > >
> > > > > I've complied my code into an example ear.
> > > > >
> > > > > http://www.jeffreyporter.pwp.blueyonder.co.uk/ebusiness.ear
> > > >
> > > >
> > > > --
> > > > Don't answer to From: address!
> > > > Mail to this account are droped if not recieved via mailinglist.
> > > > To contact me direct create the mail address by
> > > > concatenating my forename to my senders domain.
> > > >
> > >
> >
>

Reply via email to