Preserving Viewstate on form reload from a popup

J

jeffrobbins

Hello, I am having an issue that I haven't been able to find an answer
for. Any help or pointers to information would be appreciated.

I have a form, lets call it mainForm, that contains a dropdownlist of
offices that is populated from a database query, and other form
elements. A second form, lets call it childForm, can be opened
(window.open()) via a link off of mainForm to add another office to the
database. What I would like is to be able to submit childForm, then
have mainForm reload/submit, so the dropdown list of offices is
repopulated with out loosing any previously entere form data.

The problem I have been encountering is that when I use javascript to
submit mainForm, the validators fire, I don't want this. Or when I just
reload mainForm, I lose all previously entered form data. I know the
form data can be saved in the Viewstate, but how do I do it from an
event that comes from a popup window?

Please let me know if I can provide any additional information.
Thank you,
Jeffrey
 
G

Guest

Hi Jeff,

I think that the need to reload the page as opposed to use only Javascript
to add a new <option> tag to your dropdownlist would depend on whether there
are any other values on the page that are dependent on the database changes
occuring when you add the new location.

For example, if adding a new location to the database would create a primary
key that you need before displaying the dropdownlist then you should have the
"Add Location" function save the "mainform" first then redirect the Request
to your "addLocation" page (instead of using window.open) and then return
back to your page after you have reloaded all values appropriately.

But, if adding a new location on the dropdown list only needs the
information that was entered on the "addLocation" popup windows then you can
use Javascript to re-draw that dropdown box without loading the "mainform"
(Notice that the database would still be updated by the "childform".

HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top