Click to See Complete Forum and Search --> : How to prompt user to save changes after submit?


mini_dumbo
11-21-2002, 10:01 PM
Not too sure if we post to the right forum as our code this time involve PHP as well.
:confused:

Could anyone help???

What we are going to do is we have a text box, once the user change the stuf in the text box, after the submit button is clicked, a prompt will appear to ask if the user want to save changes or not.

We already did the coding which when the user type something in or delete something from the text box making the text box value different from it's default value, a warning message will appear on the title. Then when the user click submit, the whole page will refresh with the edited message in the text box. We did the refresh stuf using PHP.

Now we want to add a prompt to ask if the user want to save changes when the text box is edited. We don't know how can we pass the valuables from the PHP to the javascript. Or is there another way to do it???

Hope the description doesn't confused you !!!

:p Bo&Vic

mini_dumbo
11-24-2002, 02:20 PM
;) Thanks, that's what we want to know. But what about if we want the prompt box appears as a prompt sentence say "Do you want to save changes?" with 3 buttons of 'yes', 'no', 'cancel'. Is that possible? Cos it sort of different from the normal prompt we can use from javascript.

Cheers,
Bo&Vic :rolleyes:

mini_dumbo
11-24-2002, 07:08 PM
By the way, we did try using the confirm function, but it only give us a 'ok' and 'cancel' button. We hope we can work somthing like if we click 'yes' it will save, 'no' will not save anything, and 'cancel' will remain to the current page.

Could anyone help PLEASE !!! :eek:

Bo&Vic :p

mini_dumbo
11-24-2002, 09:22 PM
Ah, thanks, so we can't actually have a box looks like the confirm one, but have to design our own window popup.

We might have a try first then get back to u later.

:cool: Bo&Vic

mini_dumbo
11-25-2002, 03:57 PM
Thanks to your suggestion we've now created a pop up window with three buttons,:rolleyes: but now we're having trouble knowing how to link this back to have an effect on the previous page when user clicks a choice. (eg if user click "yes" for "do u want to save your changes?", we don't know how to go back to the previous page where the user has changed the input box)... we're wondering if it's possible to call(or go back and run) just a particular function in an html page from the pop up window itself(eg running a javascript function or php code etc....)... :confused:

Thanks....

Bo & Vic:D

mini_dumbo
11-25-2002, 10:10 PM
:eek: somebody please help us... !!!


Is it possible to use javascript (as in without relying on php) to achieve the following effect:

Say you have an input box, and the user types something in it and is prompted with a pop-up window with buttons "yes", "no" and "cancel", asking if he/she wants to save the changes... if user clicks yes, pop-up window will close and user will be returned to parent window with text in input box unchanged(i.e. origial text from inbox PLUS extra stuff typed in by user) , but if user clicks no, pop-up window will also close but instead of the previous case, only the original text(whatever was in it before user types anything) will remain in the box. We managed to do the "yes" case with some php codes but we're too much of a newbie in everything that we were so stuck from that point... so we're just wondering if it's possible to do the above problem entirely in javascript....

Any help would be appreciated!! :D



:p & ;)