Hello,

I was trying to understand the need for an 'autosub' event on the client and the reason for an AutoSubmitEvent on the server and could only conclude that this may be redundant. Here's what I observe

1. Whenever TrPage._autoSubmit is called, which is when an editable value holder is 'auto submitted' on the client, we always POST an event of type 'autosub' (see snapshot from Firebug).

_noJavaScript   false
event   autosub
itxt    Change this text
javax.faces.ViewState   !38sploveg
org.apache.myfaces.trinidad.faces.FORM  j_id_jsp_323026082_2
partial true

2. On the server side code in FormElementRenderer (and some of its sub-classed renderers) we call detectAutoSubmit() method that explicitly looks for the 'autoSub' event and queues an AutoSubmitEvent. Since there are typically no listeners registered for this event, the only reason this is queued is to update partial targets - (RequestContext.getCurrentInstance().partialUpdateNotify(component)). If so, this seems redundant as any value entered in the client-side UI will get submitted on the server component and a valueChange event queued anyway.

3. Finally the renderers also encode an event handler for the 'onchange' event - 'TrPage._autoSubmit()', and pass in the event name 'autoSub', but in reality the final encoded script never includes this event.

So overall the use of the 'autoSub' event on the client and the AutoSubmitEvent seems unnecessary.

I tried removing all of the above code and ran the autoSubmit usecases and it seems to work fine. (I may have missed some corner usecase if indeed this is there for a special purpose).

Please let me know if there is a special reason for this code, if not I recommend that we clean this up. I can create an issue for this and provide a patch.

Thanks
Pavitra

Reply via email to