0

Hi there,

I am totally new in javascript and i need a help because i dont know how to create script that confirm the user's choice and submit it to the parent page before the parent page make a process.

like this.

i have a page that shows the details of a certain module and there is a choice there to edit and delete the module.

if the user choose to delete that module, a window will pop up asking if the user is sure to delete that module.

if the user select no.. the pop up window will close and the parent page stay on the current page.

but if the user choose yes.. the pop up window will close and the parent window will be redirected to the process page which will process the deletion of the module.

other option is to have the command on pop up window that if the yes button is clicked, the pop up window will close and redirect the parent page to the process page.

i dont know where to start so please help me brothers.

Thanks a lot in advance.. please help. thank you..

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by daydah
0

You could use something like this:

<a href="delete.php" onclick="return confirm('Are you sure you want to delete?')">Delete</a>

Edited by chrishea: n/a

0

Oh gosh master. i didn't know my problem is that easy.. I'm really thankful to you..

Thanks a lot.. God bless you..

I am hoping that you can help me in my future projects.. thanks a lot..

0

Separating the javascript code into a function, then call that within the link worked for me. Example:

function confirmLinkAction(){
      var confirmed = confirm("Are you sure? This will remove this entry forever.");
      return confirmed;
}

And the link:

<a href="http://goingsomewhere.php" onclick="return confirmLinkAction()">Click me to see pop up</a>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.