Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic