You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by ad...@gmail.com on 2009/04/30 16:32:26 UTC

Issue with disabled componenets

Welcome,

I was testing our application and came across something that potentially  
may be an issue.
When a component is disabled it shouldn't (or so I think) accept model  
changes. However the only thing that Wicket does (unless I am largly  
mistaken) is remove the ajax actions etc., but model still can be updated.  
Imagine a following scenario:

- user has an enabled component with onblur updating behaviour
- user copies the link from said event
- certain ajax action disables the component
- user enables the component, changes its value and manually invokes the js  
snippet copied from onblur event

I thought that the planned scenario would be for Wicket to ignore such  
action. In AjaxFormComponentUpdatingBehavior#onEvent(final  
AjaxRequestTarget target)
FormComponent#inputChanged() is invoked. It tests for visibility and  
component being enabled. If it isn't it won't change rawInput. So far so  
good.
However not much further in onEvent method FormComponent#validate() is  
invoked. In it convertInput fromt eh same class is invoked. convertInput  
gets the value from getInputAsArray(). I would think that this is the place  
where it should get the rawInput (especially since that rawInput is  
retrieved from this method in inputChanged method).

I can imagine that the same would be viable for non-ajaxy way, but haven't  
tested it. However FormComponent#processInput() has the same trait:
invokes inputChanged() and the validate() so this could lead to the same  
error.

If this behaviour is intended it should be IMO explicitly stated that  
disabling a component doesn't disable it on a server side. If it is I guess  
it would be just a minor mistake of not using rawInput in valdiate method.

Whatdayathink?