Click to See Complete Forum and Search --> : Add dynamic menu items via popup


Illufox
05-12-2005, 05:34 PM
I've created a record insertion form with a few dynamic menus. Next to each menu is a "Add New" link which opens up a popup window. The popup window consists of a small form with a text field and a submit button. When the user clicks on the button, the window closes automatically and the new record is being added to the database table that contains the data for the menu.

This all sounds great, but when I refresh the page to see the new menu item, all the form field values above the menu get reset as well. That's not cool.. :o

So is there a way to make this more userfriendly?

- for example have the new record automatically selected in the dymanic menu without refreshing (would be nice :D )
or have the values in the fields remain while the page is being refreshed?

phpnovice
05-12-2005, 07:39 PM
...have the new record automatically selected in the dymanic menu without refreshing (would be nice :D )
ASP can't do that. JavaScript can, though.
...have the values in the fields remain while the page is being refreshed?
You would have to submit the content of the entire main form to the document that loads into the popup window. The field values from the main form would either be stored in Session variables or in hidden fields in the popup form. Then, the popup form would have to be submitted back to the original document in the main window. The main ASP document would rebuild the content of the fields in the main form along with the added entry for the dynamic menu.

For this whole scenario to work, though, JavaScreipt would have to be enabled -- just so that the main window could name itself. This allows the popup window to submit to the main window.

main window:

<body onload="window.name='mainWindow'; return true;">
<form ... target="_blank">

popup window:

<body>
<form ... target="mainWindow">

Illufox
05-12-2005, 07:46 PM
Wow, that's a lot to digest, but it gives me some hope....I'll try to make this work....
thanks for your help :)