473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Adding a new entry to a list menu based on a database

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

Aug 3 '05 #1
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
Aug 3 '05 #2
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.

Aug 3 '05 #3
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
Aug 3 '05 #4
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

Aug 3 '05 #5
Thanks Peter; that works beautifully!! Appreciate it.

Aug 4 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
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...
2
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...
6
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...
3
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...
1
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...
4
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...
1
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...
5
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...
2
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...
0
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$) { } ...
0
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...
0
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...
0
BarryA
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...
1
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...
0
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...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.