-----Original Message-----
Scott said:
If this helps, I using a standard button instead of a
submit button, when adding or deleting emails from the
listbox. When the new ASP page is launched after clicking
one of these two buttons, it has just a textbox and a
SUBMIT button on it.
If it only has a text box and submit, how do you identify the person to
delete?
My intention is to use this same ASP page for both adding
and deleting emails from the listbox, unless someone has a
better suggestion.
Using two pages is probably easier but using one means you need to determine
if your method is POST or GET and then you check for input to the page
before you build the page.
As I stated before, I've done more VB
programming than ASP programming,
It was weird for me when I started using ASP. VB.NET would be easier for
you. The best advice I think anyone can give you re: ASP in the beginning
is that ASP processes ONLY ASP code and passes everything else to the
client, including processed results. When you surf to an ASP page and view
the source, you're seeing the results and the ASP engine is done.
and I'd rather tag the
emails and click delete to remove them than to bring up an
ASP page to do it,
You could do it that way too. Do you want to delete one at a time or
multiple? When do you want to update the database?
but I not sure how to do it in ASP.
Adding emails this way is fine.
Yes, adding is always easier.
What I get from your posts is: (I will number these and reference them by
number in my response)
1. You have a list box where you select a group. You do not mention a
submit key so I assume this is an onChange event. Doesn't matter either
way.
2. This makes a call to a SP which dynamically builds another list box with
the email addresses of the group selected from the other list box.
3. One of two buttons is then clicked [add/delete] and a popup window which
contains a text box and a submit button is used to add/delete email
addresses for this particular group only.
4. The 'opener' window should reflect, assumingly the email address list,
the result of an additional email address or the elimination of one.
1. Since you are going to definitely add/delete records, I would populate
the groups and addresses into arrays when the page loads. This is one trip
to the server and I don't have to call it in the middle of my process,
however, one might argue it would be unnecessary if the task was aborted
before changes were made. Of course if you had 100 groups and 1000 users
per group, I'd probably rethink this. When the appropriate group was
selected, I would populate the email address list box with the appropriate
values from the array. This is faster than a trip to the server.
2. Here is where I differ on the add/delete processes being the same.
Unless you need to get a list, which is why I would populate upon entry to
the page, I would not select a group and then get a list and then click to
add an address. I would show a list and then you click add and on the add,
select the group and add the email address in one step, submit and update
the opener window, however, I think it would be better in a frame.
3. I think to delete an email address, you don't need to popup a window
except to confirm a deletion. Once you confirm, then you make a trip to the
server and update the database. If posting to the same page, then this
would be handled upon entry. You would pass the information either in the
header [method=post] or on the URL [method=get], it really doesn't matter.
I also pass a flag which identifies the task, ex.
/asp/
[email protected]&task=delete.
4. If you use a popup to add, then you assign that window a handle.
Ex. var w=window.open('',"addEmail",features);
Then you reference the handle to build the page. Loading a preset page is
easier than building it on the fly but it is a trip to the drive. Probably
not a deal killer considering the size. Now, you can either update the
opener window and then close the popup but you still need to process the
data and send it to the server. You could do that in the popup but why
duplicate code for server access? I would call to process the opener window
with the results and have it check as part of it's opening routine if the
popup is open and close it, update the server and then rebuild the list. If
you want to keep the group selected, then you need to pass another variable
identifying the group.
/asp/somefile.asp? group=corporate&
[email protected]&task=delete.
As far as your popup not working, I have a simple popup routine I use.
<!--
// Options:
// toolbar (yes,no)
// location (yes,no)
// directories (yes,no)
// status (yes,no)
// menubar (yes,no)
// scrollbars (yes,no)
// resizable (yes,no)
// copyhistory (yes,no)
// width=size
// height=size
var winHandle='';
var winname='';
function popup(url, winname) {
var features = "menubar=no, width=200, height=200";
w = window.open(url,winname,features);
if(!w.opener) w.opener = self;
// other code goes here
}
//-->
If you want multiple windows from a single page that need different
attributes, then I use:
<!--
// Author: Roland Hall
// Copyright (c) 2003 - Dangerously, Inc.
// Free for non-commercial use
// All rights reserved world wide
// Options:
// toolbar (yes,no)
// location (yes,no)
// directories (yes,no)
// status (yes,no)
// menubar (yes,no)
// scrollbars (yes,no)
// resizable (yes,no)
// copyhistory (yes,no)
// width=size
// height=size
var features, w, h;
function popupwin(url, winname, features, w, h) {
// Use the line below during debugging
//alert('url: ' + url + '\r\nwinname: ' + winname + '\r\nfeatures: ' +
features + '\r\nw : ' + w + '\r\nh : ' + h);
if(!w && !h) {
w=600; // default width
h=600; // default height
}
if(!features) {
features = 'width=' + w + ', height=' + h;
} else {
features += ', width=' + w + ', height=' + h;
}
// Use the line below during debugging
//alert('w = ' + w + '\nh = ' + h + '\nfeatures = ' + features);
popwin = window.open(url,winname,features);
}
//-->
--
Roland
This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
.