• Post Reply Bookmark Topic Watch Topic
  • New Topic

Submit causes valuechangelistener to run

 
Gina vernon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My code has a valuechangelistener that gets called when the submit button is clicked. This happens in the apply request values phase.
The valuechangelistener is triggerd by the Onchange event and uses javascript this.form.submit() to trigger the event.
Is there anyway for the valuechangelistener not to run when the submit button is clicked? Here's the code:


JSP:
<label>Part:<span class="required">*</span></label>
<h:selectOneMenu id="si5" label="partnum" immediate="true"
onchange="this.form.submit()" required="true">
<f:selectItems id="pnsis" value="#{backing_SRFdataentry.pnsis}" />
<f:valueChangeListener type="test.hib.listeners.PNValueChangeListener"/>
</h:selectOneMenu>


Thanks.
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it would be "broken" behavior if the ValueChangeListener wasn't invoked whenever the form is submitted regardless of which selection mechanism was used.

It shouldn't really matter, since ValueChangeListeners should only have extremely limited logic in them. They may be used to set hints for action processors, but they shouldn't have any heavy-duty logic in them such as loading data from a database. That's not what they're for and they won't do the job very well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!