• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JSP action link with confirmation

 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

Got a small issue. I have a commandLink element. I want to intercept the clicking of this with a javascript confirm box.

I can show the confirm box using the onClick event handler but I need to only perform the link's action if the confirm box returns true (if the OK button is clicked).

Does anyone have any idea how to do this?

Thanks in advance
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why don't u do it in faces-config.xml? u can link the page from there to go to another new page.

but if u really want to do it in javascript, u can first call a javascript function and then in the javascript function u do alert and also redirect.
[ July 04, 2005: Message edited by: Jolie Lee ]
 
Rick Beaver
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks for your reply.

I have a navigation rule in faces-config.xml - this works fine. I can also attach a JS confirmation to the command link, that pops up fine. What doesnt work is only firing the action on my command link if the user presses OK on the confirmation box
 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u can pass the message and link from ur bean to ur jsp page..

and in ur jsp page u can do something like this..

so when user clicks OK, it will go to the messageLink that u specify from ur bean.

hope this helps.
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic