Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
E Robb
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic