struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Matias Urbieta (JIRA)" <j...@apache.org>
Subject [jira] Commented: (WW-1972) <s:optiontransferselect ... items not autoselected on submit.
Date Wed, 29 Oct 2008 22:49:37 GMT

    [ https://issues.apache.org/struts/browse/WW-1972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44893#action_44893
] 

Mario Matias Urbieta commented on WW-1972:
------------------------------------------

This is the second work arround that i had to do today. I'll never use this framework again.
The main problem is that dojo plugin uses dojo to send the form in a ajax way and many struts2
components spect a
dom submit event- such as optiontransferselect-  that allows listeners to select the comprised
items.
So i emulated the traditional form submition by the following steps avoiding refactoring the
xhtml tags:

* Add a listener to the form for stopping the dom submit event bubble. This is the key, i
supposed that this listener will be the last executed ( it worked on FF3 and  IE7).
* Fire on submit event. this will excercise the listeners but will be stoped by our listener.

This JS goes at the ajax form

dojo.event.topic.subscribe("/selectAll",
		function(widget, event) {
			StrutsUtils.addEventListener(document.getElementById('${parameters.id}'), "submit", 
		function(evt) {
	dojo.event.browser.stopEvent(evt);
		}, true);
				
			fire('submit',document.getElementById('${parameters.id}'));	
				

		});



function fire(evttype,el) {
    if (document.createEvent) {
      var evt = document.createEvent('HTMLEvents');
      evt.initEvent( evttype, true, true);
      el.dispatchEvent(evt);
    } else if (document.createEventObject) {
      el.fireEvent('on' + evttype);
    }
}



and finally i had to add the following attribute to the ajax submit tag wich triggers the
emulation behavior.

beforeNotifyTopics="/selectAll"

this work arround is oblivious and seamless.


> <s:optiontransferselect ... items not autoselected on submit.
> -------------------------------------------------------------
>
>                 Key: WW-1972
>                 URL: https://issues.apache.org/struts/browse/WW-1972
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Dojo Tags
>         Environment: WindowsXP, Java 1.6, Tomcat v5.5
>            Reporter: Jan Hornbøll Hansen
>            Assignee: Jan Hornbøll Hansen
>             Fix For: Future
>
>
> Have form like:
> <s:form action="addUser" method="get">
> 	<s:textfield name="user.username"><s:param name="label"><fmt:message
key="user.label.username"/></s:param></s:textfield>
> 	<s:password name="user.password"><s:param name="label"><fmt:message key="user.label.password"/></s:param></s:password>
> 	<s:optiontransferselect name="user.roles" list="user.roles" listKey="id" listValue="name"
doubleName="roleList" doubleList="roleList" doubleListKey="id" doubleListValue="name">
> 	</s:optiontransferselect>
> 	<s:submit type="button" value="%{'add'}">
> 		<s:param name="label"><fmt:message key="global.label.add"/></s:param>
> 	</s:submit>
> </s:form>
> AddUserAction implements ParameterAware. When form submitted only parameters received
are user.username & user.password. Tag reference for <s:optiontransferselect> states
that all values in both lists are supposed to be selected before submit (so they'd also be
added as parameters).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message