Topic: php and javascript submit() (Read 2705 times)
Sandwich Artist
Posts: 25
186 credits Members referred : 0
« on: Jun 25, 2008, 09:47:10 pm »
I have several pages where users can enter data as well as click on hyperlinks that use javascript to open a popup where they can enter some more data and then save and the popup will close and the original page will refresh itself automatically. The issue is that if they enter data on the main page and then click the hyperlink without first saving the page, when they submit on the popup and the main page gets refreshed all of the data they entered on the main page is lost. Is there any way to have the main page submit before the popup gets opened so that the users don't loose their data. I've tried using the javascript document.formname.submit() but it just refreshes the page and doesn't submit the data. I changed all of my submit buttons names from submit to update so as not to cause conflict but it still just refreshes the main page then opens the popup, and all data is lost. Any ideas on how I could accomplish this task? Thanks in advance.
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5779
46271 credits Members referred : 3
« Reply #1 on: Jun 27, 2008, 10:49:59 am »
Maybe you could solve this if you were sending the unsaved data to the other pages too.
Use an onsubmit="" function to your forms in order to do that.