473,320 Members | 1,876 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,320 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 1585
> (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...
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...
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...
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.