• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript and Struts

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,
i'm using struts and writing a javascript function that shows a confirmation message before deleting an element from a collection select:

function deleteElem() {
action = confirm("Delete selected element?");
if (action == true) {
........
}
else return;
}

I don't know how to indicate the action to do in the "if" statement with Struts.
How does Struts handle the formName.submit() = 'doSomething' inside a javascript?

Thanks in advance,
David
 
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If all you need to accomplish is to confirm the user wants to delete an element, the following should suffice:



Alternately, if you have multiple submit buttons on your form and only want this action for a particular button, you can do this:


(on submit and on click should be onsubmit and onclick, the board doesn't like them)
At the end of the day, Struts is handling the server-side, javascript is handling the client-side, and the two never really meet.
[ February 16, 2005: Message edited by: Ray Stojonic ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic