This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!