• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP action link with confirmation

 
Rick Beaver
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
  • 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
 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!