This topic is locked
[SOLVED]

 Confirm Box

6/26/2011 5:54:46 PM
PHPRunner General questions
Osteele author

Could the same be accomplished when a user fills out the entire "Add Records Page" then mistakingly hits the Return to List button. How complicated would it be to add a prompt asking the user if he really wants to leave the page without first saving.
Thank you for helping



Bill,
To add a confirm box you should change the "Save" button html-code. Go to the HTML mode of the Add page on Visual Editor tab

See my changes (bold) below:
Thereafter add the JavaScipt event at the end of the document.

Here is just a sample:

<script>

function confirmation() {

var answer = confirm("Are you sure?")

if (answer) {editform1.submit()}

else {window.location.href='TableName_list.php?a=return'}

}

</script>


C
cgphp 6/26/2011

Remove the standard "Back to list" button and insert a new button and give it the same label: "Back to list".

In the "Client Before" option paste this code:

if(confirm("Do you want to leave this page ?"))

location.href = "your_page_name.php";



Leave as blank page the "Server" and the "Client After" options.
This is probably the fastest solution.

Osteele author 6/26/2011

Awesome. What a great forum. Much appreciated. Have a good one.



Remove the standard "Back to list" button and insert a new button and give it the same label: "Back to list".

In the "Client Before" option paste this code:

if(confirm("Do you want to leave this page ?"))

location.href = "your_page_name.php";



Leave as blank page the "Server" and the "Client After" options.
This is probably the fastest solution.