August 9th, 2003, 08:04 AM
I cannot make it as an "onclick" event for the button because I only want the window to pop up AFTER all the database functions are complete.
August 9th, 2003, 09:24 AM
If you're using HTML::Template, this is trivial.
August 9th, 2003, 02:29 PM
Is there a way to attach an event to a database operation in PERL? For example, OnInsertion="PopUpAlert()". =)
August 9th, 2003, 04:50 PM
Why can't you just conditionally output the onLoad event? On the first visit to the page, or any subsequent visit that doesn't meet the criteria needed to insert into the database you don't print out the alert in the onLoad.
Upon a submit that causes you to do a database insert, you trip a flag that causes your app to output the alert into the onLoad of your body tag.
If you're unable to get your HTML to do this, then you need to rethink how you're building your applications. Look at HTML::Template to create more flexible and maintainable apps.
August 9th, 2003, 06:26 PM
oh, I see it now. I just realized (or actually remembered) that the OnLoad event is fired AFTER the whole page finished loading. For some reason earlier, I kept on thinking that an OnLoad event is fired when the page just BEGINS to load (before executing any statements in the body). I guess I could get it to work now. Thanks.
First I did this:
"alert('Customer successfully added.')".
This almost worked perfectly (the alert box pops up and at the right time) but after the user clicks "OK" on the alert box and the page finishes loading, the phrase "Content-Type: text/html; charset=ISO-8859-1" gets displayed near the top of the screen. How do I get rid of that? I also tried changing the content-type to text/html and I get the same result.
Then I did:
"alert('Customer successfully added.')"
What is the correct content type that I need to use?