I have a question on how best to handle focus when an error occurs.  

I am currently using the Sandbox focus component and have implemented a
PhaseListener on my backing beans to set focus to the first input component
that has a message associated with it. On each of my backing beans I have a
setFocusId and a getFocusId Method.

Consider the following Example

Backing Bean
CountryQBE
 - getCode
 - setCode
 - getName
 - setName
 - setFocusId
 - getFocusId

CountryForm
 - getCode
 - setCode
 - getName
 - setName
 - setFocusId
 - getFocusId

    
StateForm
 - getCode
 - setCode
 - getName
 - setName
 - setFocusId
 - getFocusId

Say as a Result of Pressing a command button on the CountryForm an Error
occurs on the nameField.  When this happens the PhaseListener Fires on all
three backing beans and sets the FocusId to the nameFieldId.

Thus the CountryQBE, CountryForm and StateForm backing beans all have their
focusId property set to nameFieldId.

Is there any way to limit the phase listener to only fire for the current
form that it is processing? 

Tom 

 

Reply via email to