cearlp Posted December 27, 2010 Share Posted December 27, 2010 I define a Javascript in the <head> section of a .php file and call it from the <body> section with the following: echo "<script language='javascript'>function();</script>". The function displays a confirm box with the normal Cancel and OK buttons just fine, but I want to capture the function return of true or false for which button was selected. So far I haven't found a way to get return a value from the function. Any ideas??? Quote Link to comment Share on other sites More sharing options...
JD* Posted December 27, 2010 Share Posted December 27, 2010 I'm assuming that you're going to be sending this to a script on the server itself, yes? If so, you can probably write some javascript that would add the return value to a hidden form value and then submit the form, which can then process. Quote Link to comment Share on other sites More sharing options...
cearlp Posted December 27, 2010 Author Share Posted December 27, 2010 I wasn't looking at it that way. My flow is like this: As stated, the function is in the <head> section of the file. A form is displayed and if the submit button is selected the page reloads itself. If isset($_POST['submit'] is true certain fields are checked for being blank. If they are, an alert box is displayed and the form is re-displayed with the data that has already been filled in. If the fields are not blank processing continues and later in the process flow a database is going to be updated. At this point I want to call a confirm function to display a confirm box and need the response of either OK or Cancel to either continue the update or re-display the form. Does this make sense? Quote Link to comment Share on other sites More sharing options...
JD* Posted December 27, 2010 Share Posted December 27, 2010 In that case, it sounds like this should be directed to the javascript forum, as it can all be done via those scripts. Quote Link to comment Share on other sites More sharing options...
cearlp Posted December 27, 2010 Author Share Posted December 27, 2010 Thanks, I will post to the javascript forum. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.