
dang
Posts: 11
|
| Posted: 06/26/2004, 10:16 AM |
|
Hi
I've got a record form. In this form, there is a Listbox populated by a table. Most of the time, user have only to select the item in the Listbox. But, when the information is not on the Listbox, he add/modify record on separate window.
The problem is how to Requery or Repopulate or Refresh the Listbox when items has been added to the file?
Regards
_________________
Dan |
 |
 |
peterr
Posts: 5971
|
| Posted: 06/26/2004, 11:19 AM |
|
I'm not aware of any method to do that except refreshing the whole page.
There is not much on the net either: http://www.google.com/search?q=%22reload+listbox%22 http://www.google.com/search?q=%22refresh+listbox%22 http://www.google.com/search?q=%22repopulate+listbox%22 http://www.google.com/search?q=%22reload+a+listbox%22 http://www.google.com/search?q=%22refresh+a+listbox%22 http://www.google.com/search?q=%22repopulate+a+listbox%22
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
dang
Posts: 11
|
| Posted: 06/26/2004, 1:32 PM |
|
Hi Peter
Here a working solution that do exactly what I'm looking for. I found it at http://forums.aspfree.com/t19253/s.html by David13.
Quote :
You can do like this :
Once your form is published you can add a link in the popup "close this window"
You set the event onclick='javascript:window.opener.location.reload();window.close();' in <A> tag
Example :
<a href="#" onclick="javascript:window.opener.location.reload();window.close();">Close this window</a>
This will cause the parent window to reload, so re-execute your asp script and all sql queries.
And your listbox will be populated with the new entry.
_________________
Dan |
 |
 |
peterr
Posts: 5971
|
| Posted: 06/26/2004, 2:00 PM |
|
Yeah, that's what I meant above by "refreshing the whole page". But this method doesn't requery the listbox, only refreshes the whole page and you will loose all the data that was already entered by the user. If this is not a problem for you then that refreshing the page will work.
There is actually one method to refresh just the listbox but more tricky. It's the one at http://www.atgconsulting.com/gofetch.asp , which was also adapted by Rob in CCS and can be seen at http://www.sylvancomputing.com/ccs/deplist/updDepList.asp
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Juan Carlo
|
| Posted: 08/01/2005, 4:09 PM |
|
you can put this javascript's function on the button save:
-------------------------------------------
function addElement(strText, strValue)
{
with(window.opener.document.forms[0])
{
lstElements.options[lstElements.length] = new Option(strText, strValue);
window.close();
}
}
-------------------------------------------
where "lstElements" is the listbox in the opener window, good luck :)
|
|
|
 |
|

|
|
|
|