wood burning stoves*
The moose likes Struts and the fly likes Altering StrutsUtils.addEventListener behavior in utils.js /Customizing the framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Altering StrutsUtils.addEventListener behavior in utils.js /Customizing the framework" Watch "Altering StrutsUtils.addEventListener behavior in utils.js /Customizing the framework" New topic
Author

Altering StrutsUtils.addEventListener behavior in utils.js /Customizing the framework

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
I would like some way to fine tune the utils.js behavior. I am using 3 optiontransferselect boxes on a page. utils.js generates this code automatically in the page to select all the items in both select boxes when the form is submitted.



I dont need the values in the right hand multiselect list box submitted so I dont need them all selected. So ideally what I would like to do is somehow alter the framework so if it sees option select transfer object this is printed out as the javascript in the page



I know I can remove the lefthand option transfer events by altering Template/simple/form-close.ftl at the top but thats actually the portion I want to retain & can use to change the left hand js function called. I would like to remove the Right hand portion of the selectAllOptionsExceptSome

Is this where I should be concenrating my efforts. Ive never worked with ftl files except for basic css. Even if I comment out all of the optiontransferselect at the top of form-close.ftl struts still generates submit events for exactly the portion I dont want to deal with. The page renders with this javascript:


E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
I was on the right track with influencing the behavior StrutsUtils.addEventListener but did not look far enough down in the simple/form-close.ftl. If you dont want the option values on the right to be selected on submit you can comment out the following code that starts on line 64



Thanks
 
Consider Paul's rocket mass heater.
 
subject: Altering StrutsUtils.addEventListener behavior in utils.js /Customizing the framework