Let's say I have a dynamic list/menu, which gets its values from a
database table, for example a list of contact people where the value is
an ID number and the label is the name. However, if the value the user
wants is not in the list I would like to place a hyperlink which
will...
(1) open a small window, with an ASP form to allow the user to add a
new entry
(2) save the entry to the database
(3) add that value to the list/menu in the parent window and make it
the selected option
(4) close the small window and return to the original window.
I can handle the code for 1,2 and 4, but 3 is what I'm not sure about.
I don't like the idea of forcing the user to leave the current screen,
go to some other form, add the entry they need to the lookup table,
then come back; this seems like a logical approach, but just wondering
how to make it work.
This seems like a common enough situation; anyone have any code samples
or suggestions about how to do this?
Thanks in advance, and email responses preferred.
Regards,
Derek Gould
Newfoundland, Canada 5 1971
> (3) add that value to the list/menu in the parent window and make it the selected option
I can handle the code for 1,2 and 4, but 3 is what I'm not sure about. I don't like the idea of forcing the user to leave the current screen, go to some other form, add the entry they need to the lookup table, then come back; this seems like a logical approach, but just wondering how to make it work.
call the parent window to refresh when the child (modal?) is
closed/returned.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
I don't want to refresh the parent window, since the user may have
completed half the form and I don't want to reset all values to
default. I just want to update the dropdown by adding the new item to
it, and set it as the currently selected option.
Derek wrote: I don't want to refresh the parent window, since the user may have completed half the form and I don't want to reset all values to default. I just want to update the dropdown by adding the new item to it, and set it as the currently selected option.
Ok.. you never mentioned it was a DropDown, you said dynamic list...
guess I interpreted that differently.
Only way you can do this would be to pass the info to clientside
javascript, so the ASP group (where I'm answering you from is probably
not a good place to look.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Here's a small code sample you can paste to test out. you can pass your
dynamic values to get it to work. put this on the parent page and call
it from your pop-up, but remember to use the "opener" keyword >>
opener.addOption(val,val,val) so it will call the right place.
<html><head>
<script language="javascript" type="text/javascript">
function addOption(combo,text,value)
{
var newOpt=new Option(text,value);
var len=document.getElementById(combo).options.length;
document.getElementById(combo).options[len]=newOpt;
document.getElementById(combo).options[len].selected=true;
}
</script>
</head>
<body >
<form>
<select name="sel" id="sel">
<option value="coke">Coca-Cola</option>
</select>
<input type="button" onclick="addOption('sel','Pepsi-Cola','pepsi')"
value="add" />
</body>
</html>
if you need more info on integrating it, just ask.
TheGeek
Thanks Peter; that works beautifully!! Appreciate it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Derek |
last post by:
Let's say I have a dynamic list/menu, which gets its values from a
database table, for example a list of contact people where the value is
an ID number and the label is the name. However, if the...
|
by: btober |
last post by:
I run the following script to export some data from my development
database and then update or insert the records into to the quality
assurance testing database, but I get a warning notice that I...
|
by: Joe |
last post by:
I have 2 multi-list boxes, 1 displays course categories based on a
table called CATEGORIES. This table has 2 fields CATEGORY_ID,
CATEGORY_NAME
The other multi-list box displays courses based on...
|
by: Robin Thomas |
last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental.
Anyway, quite often I am pulling data from a database, but then I need to
use that data to produce more data. A simple...
|
by: C Downey |
last post by:
I have a registration form that should load different web user controls
based on the selection of a dropdown list. Basically, the user follows the
following steps:
1. user comes to very basic...
|
by: Kevin |
last post by:
Hello. My app uses user-based menu generation where all of the menu items are loaded from a SQLServer 2k database when the user logs in to the app. All is well except I cannot get an Access Key to...
|
by: stinehelferw |
last post by:
I need a right-click menu on a form list control with combobox
controls.
I used View->Toolbars->Customize to create a toolbar.
I added ComboBox through commands tab.
I set properties to Popup...
|
by: Justin Fancy |
last post by:
Hi everyone,
I need some help. I'm placing text files into a created database using
vb.Net. The problem is that, i need two seperate sql statements to add
both files because they are in...
|
by: MCM |
last post by:
I'm working on a plotting control. The plotting control will have a context
menu with basic commands for "scaling", "zooming", etc. Is there a way
that, from the parent form, I can add more...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |