Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF valuechangeListener not detecting a change for values entered manually in a text field.

 
Padma Priya
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a specific scenerio

I have a form which has 2 text fileds.

One text field is actually a date field which has a date picker component. So either we can use the date picker to pick the date or enter the date manually. Based on the date that is being selected the other textfield is either enabled or disabled.

So in this scenerio the other text field should be enabled for the date i enter in the date field either manually or through the date picker component.

But when i select the date through the date picker the other text field is enabled but not when i try to add the date manually. But this should be not the case. The other text fild should be enable should be enabled irrespective of wether we select it through the date picker or enter manually.

Does anyone tell me how to do this.

For the date text field below is the code




the value change listener is as shown below





Thanks in advance for your help

With Regards
Chakravarthy
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange - you have <hx:inputHelperDatePicker></hx:inputHelperDatePicker> as a child
component of h:inputText. So hx:inputHelperDatePicker is a composite component you or
one of your colleagues has written to call some JS or jQuery function, yes?

Put the h:inputText inside the composite component, you'll need to use f:convertDateTime
as a child of the inputText component. The composite needs a <composite:attribute name
="value" type="java.util.Date"> attribute.

So your composite component isn't just a helper any more, it's a bona fides date input
component.

The main thing I notice is this old fashioned full page submit stuff you're doing. In all
fairness though I'm still working on putting together an input date/time composite that
is ajax enabled.

I know how to do ajax enabled composite components well enough but haven't figured
out if/how I can get a standard inputText component to generate a 'simulated' js event.

Regards,
Brendan.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic