473,416 Members | 1,751 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,416 software developers and data experts.

A selection changes on asp page with 6 dependent list boxes, when back

Hello
I have 6 dependent list boxes on my ASP page:
 Faculty;
 Lecturer;
 Course;
 Course occurrence;
 Group;
 Week commencing date.
When faculty is selected, lists of lecturers and courses are
populated. When course is selected, lists of occurrences, groups and
dates are populated.
All data to populate list boxes come from a database on SQL server,
from separate recordsets. List boxes are populated on the client side
using functions generated in the source, when asp page is processed on
the server side. An example:
function populateLecturer_from_Faculty(Faculty) {
prodBox1 = document.getSearch.selLecturer
clearBox(prodBox1);
switch (Faculty) {

case 'ABT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Baxxr, V', '52');

addBoxItem(prodBox1, 'Coxxly, M', '293');

addBoxItem(prodBox1, 'Dxxn, T', '357');

break;

case 'BMP' :
addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
'4197');

addBoxItem(prodBox1, 'Caxxde, J', '2779');

addBoxItem(prodBox1, 'Vowxxs, C', '1279');

break;

case 'CHT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Bisxxp, E', '2763');

addBoxItem(prodBox1, 'Brxxey, D, '172');

break;

case 'CLT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Garxxng, M', '471');

addBoxItem(prodBox1, 'Waxxh, J', '1302');

break;

and so on.

It is of course a very long source, but it works.
When user selects everything, the selection uniquely identifies a
group of students. When user clicks the button Submit, another asp
page is activated showing room(s) occupied by this group on each day
of the selected week. It also works.
My problem: when user clicks the button Back of the browser to return
to the selection asp page, the selection disappears. All list boxes
return to the full initial lists of faculties, lecturers, courses and
so on and the first item of each list is shown rather then that one
that was selected.
Why does asp page changes, when user navigates back to it? How can I
prevent this change? I want my users to see the same data, when they
return to the page.
The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a
large college, we have PCs in different stages of Windows update.) The
problem looks the same on both browsers.
Any help will be greatly appreciated.
Thank you.
Galina
Nov 18 '05 #1
8 2530
Do you mean that when a user chooses faculty for example, the page is posted
back to the server to get the values for lists of lectures and courses?
or Do you mean that all those values are taken from the database once and
client side script handles the case when the user makes his choices?
If you use the option of getting the data from the database at start and
then a client side script would handle the choices of the user, the page is
not posted back unless the submit button is clicked. In this case, when the
user presses the back button, the web browser would return to the first page
and the choices won't be saved. If this is actually your scenario and you
want the back button to return to the choices the user made, then you could
make the list boxes post back (set AutoPostBackBack property to true) and
retrieve the data from the database in that event. This means that when a
user makes a choice in one of the listboxes, the request will be posted to
the server and the needed data is retrieved and returned to the client.
This way would make the loading of the page quicker in the first time, but
would need make more roundtrips between the server and the user's browser
when the user makes a selection from the list boxes.

regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Hello
I have 6 dependent list boxes on my ASP page:
 Faculty;
 Lecturer;
 Course;
 Course occurrence;
 Group;
 Week commencing date.
When faculty is selected, lists of lecturers and courses are
populated. When course is selected, lists of occurrences, groups and
dates are populated.
All data to populate list boxes come from a database on SQL server,
from separate recordsets. List boxes are populated on the client side
using functions generated in the source, when asp page is processed on
the server side. An example:
function populateLecturer_from_Faculty(Faculty) {
prodBox1 = document.getSearch.selLecturer
clearBox(prodBox1);
switch (Faculty) {

case 'ABT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Baxxr, V', '52');

addBoxItem(prodBox1, 'Coxxly, M', '293');

addBoxItem(prodBox1, 'Dxxn, T', '357');

break;

case 'BMP' :
addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
'4197');

addBoxItem(prodBox1, 'Caxxde, J', '2779');

addBoxItem(prodBox1, 'Vowxxs, C', '1279');

break;

case 'CHT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Bisxxp, E', '2763');

addBoxItem(prodBox1, 'Brxxey, D, '172');

break;

case 'CLT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Garxxng, M', '471');

addBoxItem(prodBox1, 'Waxxh, J', '1302');

break;

and so on.

It is of course a very long source, but it works.
When user selects everything, the selection uniquely identifies a
group of students. When user clicks the button Submit, another asp
page is activated showing room(s) occupied by this group on each day
of the selected week. It also works.
My problem: when user clicks the button Back of the browser to return
to the selection asp page, the selection disappears. All list boxes
return to the full initial lists of faculties, lecturers, courses and
so on and the first item of each list is shown rather then that one
that was selected.
Why does asp page changes, when user navigates back to it? How can I
prevent this change? I want my users to see the same data, when they
return to the page.
The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a
large college, we have PCs in different stages of Windows update.) The
problem looks the same on both browsers.
Any help will be greatly appreciated.
Thank you.
Galina

Nov 18 '05 #2
Mohamed
Thank you very much for your answer.

I have set AutoPostBackBack property to true, I hope, correctly:
<select name="selFaculty" AUTOPOSTBACK = TRUE
onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].value),
populateCourse_from_Faculty(this.options[this.selectedIndex].value);">

Would it be possible for you to point me in a direction of a code,
which retrieves the data from the database, when selected item is auto
posted? It is my very first asp page...
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in message news:<#n**************@TK2MSFTNGP11.phx.gbl>...
Do you mean that when a user chooses faculty for example, the page is posted
back to the server to get the values for lists of lectures and courses?
or Do you mean that all those values are taken from the database once and
client side script handles the case when the user makes his choices?
If you use the option of getting the data from the database at start and
then a client side script would handle the choices of the user, the page is
not posted back unless the submit button is clicked. In this case, when the
user presses the back button, the web browser would return to the first page
and the choices won't be saved. If this is actually your scenario and you
want the back button to return to the choices the user made, then you could
make the list boxes post back (set AutoPostBackBack property to true) and
retrieve the data from the database in that event. This means that when a
user makes a choice in one of the listboxes, the request will be posted to
the server and the needed data is retrieved and returned to the client.
This way would make the loading of the page quicker in the first time, but
would need make more roundtrips between the server and the user's browser
when the user makes a selection from the list boxes.

regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Hello
I have 6 dependent list boxes on my ASP page:
 Faculty;
 Lecturer;
 Course;
 Course occurrence;
 Group;
 Week commencing date.
When faculty is selected, lists of lecturers and courses are
populated. When course is selected, lists of occurrences, groups and
dates are populated.
All data to populate list boxes come from a database on SQL server,
from separate recordsets. List boxes are populated on the client side
using functions generated in the source, when asp page is processed on
the server side. An example:
function populateLecturer_from_Faculty(Faculty) {
prodBox1 = document.getSearch.selLecturer
clearBox(prodBox1);
switch (Faculty) {

case 'ABT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Baxxr, V', '52');

addBoxItem(prodBox1, 'Coxxly, M', '293');

addBoxItem(prodBox1, 'Dxxn, T', '357');

break;

case 'BMP' :
addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
'4197');

addBoxItem(prodBox1, 'Caxxde, J', '2779');

addBoxItem(prodBox1, 'Vowxxs, C', '1279');

break;

case 'CHT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Bisxxp, E', '2763');

addBoxItem(prodBox1, 'Brxxey, D, '172');

break;

case 'CLT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Garxxng, M', '471');

addBoxItem(prodBox1, 'Waxxh, J', '1302');

break;

and so on.

It is of course a very long source, but it works.
When user selects everything, the selection uniquely identifies a
group of students. When user clicks the button Submit, another asp
page is activated showing room(s) occupied by this group on each day
of the selected week. It also works.
My problem: when user clicks the button Back of the browser to return
to the selection asp page, the selection disappears. All list boxes
return to the full initial lists of faculties, lecturers, courses and
so on and the first item of each list is shown rather then that one
that was selected.
Why does asp page changes, when user navigates back to it? How can I
prevent this change? I want my users to see the same data, when they
return to the page.
The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a
large college, we have PCs in different stages of Windows update.) The
problem looks the same on both browsers.
Any help will be greatly appreciated.
Thank you.
Galina

Nov 18 '05 #3
Are you using ASP or ASP.net?
If you are using ASP, then there is no AutoPostback property. In this case,
you should make each of the listboxes submit values to an asp page (could be
the same page) which get the values from the database (the usual way you
did before).

I see from your code that you are using "select" which is an HTML control,
so it's better that you use the previous strategy in all cases rather than
using the AutoPostBack Property.

In general the old code that you used before to connect to the database
should suffice your need.
A good ASP site that contains some tutorials is:
http://www.4guysfromrolla.com

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Mohamed
Thank you very much for your answer.

I have set AutoPostBackBack property to true, I hope, correctly:
<select name="selFaculty" AUTOPOSTBACK = TRUE
onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val
ue), populateCourse_from_Faculty(this.options[this.selectedIndex].value);">

Would it be possible for you to point me in a direction of a code,
which retrieves the data from the database, when selected item is auto
posted? It is my very first asp page...
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<#n**************@TK2MSFTNGP11.phx.gbl>...
Do you mean that when a user chooses faculty for example, the page is posted back to the server to get the values for lists of lectures and courses?
or Do you mean that all those values are taken from the database once and client side script handles the case when the user makes his choices?
If you use the option of getting the data from the database at start and
then a client side script would handle the choices of the user, the page is not posted back unless the submit button is clicked. In this case, when the user presses the back button, the web browser would return to the first page and the choices won't be saved. If this is actually your scenario and you want the back button to return to the choices the user made, then you could make the list boxes post back (set AutoPostBackBack property to true) and retrieve the data from the database in that event. This means that when a user makes a choice in one of the listboxes, the request will be posted to the server and the needed data is retrieved and returned to the client.
This way would make the loading of the page quicker in the first time, but would need make more roundtrips between the server and the user's browser when the user makes a selection from the list boxes.

regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Hello
I have 6 dependent list boxes on my ASP page:
 Faculty;
 Lecturer;
 Course;
 Course occurrence;
 Group;
 Week commencing date.
When faculty is selected, lists of lecturers and courses are
populated. When course is selected, lists of occurrences, groups and
dates are populated.
All data to populate list boxes come from a database on SQL server,
from separate recordsets. List boxes are populated on the client side
using functions generated in the source, when asp page is processed on
the server side. An example:
function populateLecturer_from_Faculty(Faculty) {
prodBox1 = document.getSearch.selLecturer
clearBox(prodBox1);
switch (Faculty) {

case 'ABT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Baxxr, V', '52');

addBoxItem(prodBox1, 'Coxxly, M', '293');

addBoxItem(prodBox1, 'Dxxn, T', '357');

break;

case 'BMP' :
addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
'4197');

addBoxItem(prodBox1, 'Caxxde, J', '2779');

addBoxItem(prodBox1, 'Vowxxs, C', '1279');

break;

case 'CHT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Bisxxp, E', '2763');

addBoxItem(prodBox1, 'Brxxey, D, '172');

break;

case 'CLT' :
addBoxItem(prodBox1, ' ', '*');

addBoxItem(prodBox1, 'Garxxng, M', '471');

addBoxItem(prodBox1, 'Waxxh, J', '1302');

break;

and so on.

It is of course a very long source, but it works.
When user selects everything, the selection uniquely identifies a
group of students. When user clicks the button Submit, another asp
page is activated showing room(s) occupied by this group on each day
of the selected week. It also works.
My problem: when user clicks the button Back of the browser to return
to the selection asp page, the selection disappears. All list boxes
return to the full initial lists of faculties, lecturers, courses and
so on and the first item of each list is shown rather then that one
that was selected.
Why does asp page changes, when user navigates back to it? How can I
prevent this change? I want my users to see the same data, when they
return to the page.
The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a
large college, we have PCs in different stages of Windows update.) The
problem looks the same on both browsers.
Any help will be greatly appreciated.
Thank you.
Galina

Nov 18 '05 #4
Mohamed
Thank you for your help. I really appreciate it.
It is very interesting idea - to submit form to itself. A question:
with my 6 select boxes I'll submit the form to itself 5 times:
<form action=thesamepage.asp method=post>
Then, when something is selected in the very last box and user clicks
the button Submit, I need to pass information to another form. I am
sure it should be very simple, but I cannot find it, how to submit a
form to itself and, after certain event, to a different form?

4guysfromrolla site you recommend is very useful and very easy to
read.

Thank you once more.
Best Regards.
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in message news:<#u**************@TK2MSFTNGP11.phx.gbl>...
Are you using ASP or ASP.net?
If you are using ASP, then there is no AutoPostback property. In this case,
you should make each of the listboxes submit values to an asp page (could be
the same page) which get the values from the database (the usual way you
did before).

I see from your code that you are using "select" which is an HTML control,
so it's better that you use the previous strategy in all cases rather than
using the AutoPostBack Property.

In general the old code that you used before to connect to the database
should suffice your need.
A good ASP site that contains some tutorials is:
http://www.4guysfromrolla.com

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Mohamed
Thank you very much for your answer.

I have set AutoPostBackBack property to true, I hope, correctly:
<select name="selFaculty" AUTOPOSTBACK = TRUE

onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val
ue),
populateCourse_from_Faculty(this.options[this.selectedIndex].value);">

Would it be possible for you to point me in a direction of a code,
which retrieves the data from the database, when selected item is auto
posted? It is my very first asp page...
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<#n**************@TK2MSFTNGP11.phx.gbl>...
Do you mean that when a user chooses faculty for example, the page is posted back to the server to get the values for lists of lectures and courses?
or Do you mean that all those values are taken from the database once and client side script handles the case when the user makes his choices?
If you use the option of getting the data from the database at start and
then a client side script would handle the choices of the user, the page is not posted back unless the submit button is clicked. In this case, when the user presses the back button, the web browser would return to the first page and the choices won't be saved. If this is actually your scenario and you want the back button to return to the choices the user made, then you could make the list boxes post back (set AutoPostBackBack property to true) and retrieve the data from the database in that event. This means that when a user makes a choice in one of the listboxes, the request will be posted to the server and the needed data is retrieved and returned to the client.
This way would make the loading of the page quicker in the first time, but would need make more roundtrips between the server and the user's browser when the user makes a selection from the list boxes.

regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
> Hello
> I have 6 dependent list boxes on my ASP page:
>  Faculty;
>  Lecturer;
>  Course;
>  Course occurrence;
>  Group;
>  Week commencing date.
> When faculty is selected, lists of lecturers and courses are
> populated. When course is selected, lists of occurrences, groups and
> dates are populated.
> All data to populate list boxes come from a database on SQL server,
> from separate recordsets. List boxes are populated on the client side
> using functions generated in the source, when asp page is processed on
> the server side. An example:
> function populateLecturer_from_Faculty(Faculty) {
> prodBox1 = document.getSearch.selLecturer
> clearBox(prodBox1);
> switch (Faculty) {
>
> case 'ABT' :
> addBoxItem(prodBox1, ' ', '*');
>
> addBoxItem(prodBox1, 'Baxxr, V', '52');
>
> addBoxItem(prodBox1, 'Coxxly, M', '293');
>
> addBoxItem(prodBox1, 'Dxxn, T', '357');
>
> break;
>
> case 'BMP' :
> addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
> '4197');
>
> addBoxItem(prodBox1, 'Caxxde, J', '2779');
>
> addBoxItem(prodBox1, 'Vowxxs, C', '1279');
>
> break;
>
> case 'CHT' :
> addBoxItem(prodBox1, ' ', '*');
>
> addBoxItem(prodBox1, 'Bisxxp, E', '2763');
>
> addBoxItem(prodBox1, 'Brxxey, D, '172');
>
> break;
>
> case 'CLT' :
> addBoxItem(prodBox1, ' ', '*');
>
> addBoxItem(prodBox1, 'Garxxng, M', '471');
>
> addBoxItem(prodBox1, 'Waxxh, J', '1302');
>
> break;
>
> and so on.
>
> It is of course a very long source, but it works.
> When user selects everything, the selection uniquely identifies a
> group of students. When user clicks the button Submit, another asp
> page is activated showing room(s) occupied by this group on each day
> of the selected week. It also works.
> My problem: when user clicks the button Back of the browser to return
> to the selection asp page, the selection disappears. All list boxes
> return to the full initial lists of faculties, lecturers, courses and
> so on and the first item of each list is shown rather then that one
> that was selected.
> Why does asp page changes, when user navigates back to it? How can I
> prevent this change? I want my users to see the same data, when they
> return to the page.
> The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a
> large college, we have PCs in different stages of Windows update.) The
> problem looks the same on both browsers.
> Any help will be greatly appreciated.
> Thank you.
> Galina

Nov 18 '05 #5
Anytime :)

I have 3 different ways in mind to make what you want:
1. You could make the submit button a normal button (use type="button"
instead of type="submit") and make its onclick event calls a javascipt
function.
The javscript function should check the event and then set the action
proprty of the form to the needed asp page whether it's the same page or
another one(<FormID>.action = "<WebPagePath>"); after that the javascript
function should call the submit method on the form (<FormID>.submit)

2. You could make the last select box in a different form and have a
separate submit button. This helps you make this new form have a different
action and go to a different page. (This might not be appealing).

3. Make all events post to the same page and put a server side script at the
very top of the page to check for the events that should send to other
pages. If you should send to another page, you could use response.redirect
method (This solution is the least appealing because it posts back to the
same page again then redirects to the other page in case of that event which
is an overhead).

The best solution is the first one but it needs that you write some
javascript code (Very little though. About 5 or 6 lines of code only)

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Mohamed
Thank you for your help. I really appreciate it.
It is very interesting idea - to submit form to itself. A question:
with my 6 select boxes I'll submit the form to itself 5 times:
<form action=thesamepage.asp method=post>
Then, when something is selected in the very last box and user clicks
the button Submit, I need to pass information to another form. I am
sure it should be very simple, but I cannot find it, how to submit a
form to itself and, after certain event, to a different form?

4guysfromrolla site you recommend is very useful and very easy to
read.

Thank you once more.
Best Regards.
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<#u**************@TK2MSFTNGP11.phx.gbl>...
Are you using ASP or ASP.net?
If you are using ASP, then there is no AutoPostback property. In this case, you should make each of the listboxes submit values to an asp page (could be the same page) which get the values from the database (the usual way you did before).

I see from your code that you are using "select" which is an HTML control, so it's better that you use the previous strategy in all cases rather than using the AutoPostBack Property.

In general the old code that you used before to connect to the database
should suffice your need.
A good ASP site that contains some tutorials is:
http://www.4guysfromrolla.com

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Mohamed
Thank you very much for your answer.

I have set AutoPostBackBack property to true, I hope, correctly:
<select name="selFaculty" AUTOPOSTBACK = TRUE

onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val ue),
populateCourse_from_Faculty(this.options[this.selectedIndex].value);">

Would it be possible for you to point me in a direction of a code,
which retrieves the data from the database, when selected item is auto
posted? It is my very first asp page...
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<#n**************@TK2MSFTNGP11.phx.gbl>...
> Do you mean that when a user chooses faculty for example, the page is
posted
> back to the server to get the values for lists of lectures and
courses? > or Do you mean that all those values are taken from the database once and
> client side script handles the case when the user makes his choices?
>
>
> If you use the option of getting the data from the database at start
and > then a client side script would handle the choices of the user, the page is
> not posted back unless the submit button is clicked. In this case,
when the
> user presses the back button, the web browser would return to the
first page
> and the choices won't be saved. If this is actually your scenario
and you
> want the back button to return to the choices the user made, then
you could
> make the list boxes post back (set AutoPostBackBack property to
true) and
> retrieve the data from the database in that event. This means that
when a
> user makes a choice in one of the listboxes, the request will be
posted to
> the server and the needed data is retrieved and returned to the
client. > This way would make the loading of the page quicker in the first time, but
> would need make more roundtrips between the server and the user's

browser
> when the user makes a selection from the list boxes.
>
> regards
> Mohamed El Ashmawy
> Microsoft GTSC Developer support for Middle East
>
> "Galina" <ga*********@cityofbristol.ac.uk> wrote in message
> news:cc**************************@posting.google.c om...
> > Hello
> > I have 6 dependent list boxes on my ASP page:
> >  Faculty;
> >  Lecturer;
> >  Course;
> >  Course occurrence;
> >  Group;
> >  Week commencing date.
> > When faculty is selected, lists of lecturers and courses are
> > populated. When course is selected, lists of occurrences, groups

and > > dates are populated.
> > All data to populate list boxes come from a database on SQL server, > > from separate recordsets. List boxes are populated on the client side > > using functions generated in the source, when asp page is processed on > > the server side. An example:
> > function populateLecturer_from_Faculty(Faculty) {
> > prodBox1 = document.getSearch.selLecturer
> > clearBox(prodBox1);
> > switch (Faculty) {
> >
> > case 'ABT' :
> > addBoxItem(prodBox1, ' ', '*');
> >
> > addBoxItem(prodBox1, 'Baxxr, V', '52');
> >
> > addBoxItem(prodBox1, 'Coxxly, M', '293');
> >
> > addBoxItem(prodBox1, 'Dxxn, T', '357');
> >
> > break;
> >
> > case 'BMP' :
> > addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
> > '4197');
> >
> > addBoxItem(prodBox1, 'Caxxde, J', '2779');
> >
> > addBoxItem(prodBox1, 'Vowxxs, C', '1279');
> >
> > break;
> >
> > case 'CHT' :
> > addBoxItem(prodBox1, ' ', '*');
> >
> > addBoxItem(prodBox1, 'Bisxxp, E', '2763');
> >
> > addBoxItem(prodBox1, 'Brxxey, D, '172');
> >
> > break;
> >
> > case 'CLT' :
> > addBoxItem(prodBox1, ' ', '*');
> >
> > addBoxItem(prodBox1, 'Garxxng, M', '471');
> >
> > addBoxItem(prodBox1, 'Waxxh, J', '1302');
> >
> > break;
> >
> > and so on.
> >
> > It is of course a very long source, but it works.
> > When user selects everything, the selection uniquely identifies a
> > group of students. When user clicks the button Submit, another asp
> > page is activated showing room(s) occupied by this group on each day > > of the selected week. It also works.
> > My problem: when user clicks the button Back of the browser to return > > to the selection asp page, the selection disappears. All list boxes > > return to the full initial lists of faculties, lecturers, courses and > > so on and the first item of each list is shown rather then that one > > that was selected.
> > Why does asp page changes, when user navigates back to it? How can I > > prevent this change? I want my users to see the same data, when they > > return to the page.
> > The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a > > large college, we have PCs in different stages of Windows update.) The > > problem looks the same on both browsers.
> > Any help will be greatly appreciated.
> > Thank you.
> > Galina

Nov 18 '05 #6
Great! Thank you very much! Luckily, I have already had a small java
script function - to check, what users enter. I have added commands
you recommend and yes, I get another form on the screen! Of course,
there is still plenty of work changing recordsets and code, if I
submit form every time user selects something, but I expect my asp
page to be simpler and faster with this method.

Interesting, that me and a collegue of mine have tried the 1st method
to re-direct to another form, but we used "Submit" type button, and it
didn't work. If you have a minute and it is easy to explain, why
"button" type button re-directs and "Submit" type button using the
same function doesn't?
Thank you once more. It is very kind of you to help such novices as
myself.

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in message news:<Od**************@TK2MSFTNGP10.phx.gbl>...
Anytime :)

I have 3 different ways in mind to make what you want:
1. You could make the submit button a normal button (use type="button"
instead of type="submit") and make its onclick event calls a javascipt
function.
The javscript function should check the event and then set the action
proprty of the form to the needed asp page whether it's the same page or
another one(<FormID>.action = "<WebPagePath>"); after that the javascript
function should call the submit method on the form (<FormID>.submit)

2. You could make the last select box in a different form and have a
separate submit button. This helps you make this new form have a different
action and go to a different page. (This might not be appealing).

3. Make all events post to the same page and put a server side script at the
very top of the page to check for the events that should send to other
pages. If you should send to another page, you could use response.redirect
method (This solution is the least appealing because it posts back to the
same page again then redirects to the other page in case of that event which
is an overhead).

The best solution is the first one but it needs that you write some
javascript code (Very little though. About 5 or 6 lines of code only)

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Mohamed
Thank you for your help. I really appreciate it.
It is very interesting idea - to submit form to itself. A question:
with my 6 select boxes I'll submit the form to itself 5 times:
<form action=thesamepage.asp method=post>
Then, when something is selected in the very last box and user clicks
the button Submit, I need to pass information to another form. I am
sure it should be very simple, but I cannot find it, how to submit a
form to itself and, after certain event, to a different form?

4guysfromrolla site you recommend is very useful and very easy to
read.

Thank you once more.
Best Regards.
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<#u**************@TK2MSFTNGP11.phx.gbl>...
Are you using ASP or ASP.net?
If you are using ASP, then there is no AutoPostback property. In this case, you should make each of the listboxes submit values to an asp page (could be the same page) which get the values from the database (the usual way you did before).

I see from your code that you are using "select" which is an HTML control, so it's better that you use the previous strategy in all cases rather than using the AutoPostBack Property.

In general the old code that you used before to connect to the database
should suffice your need.
A good ASP site that contains some tutorials is:
http://www.4guysfromrolla.com

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
> Mohamed
> Thank you very much for your answer.
>
> I have set AutoPostBackBack property to true, I hope, correctly:
> <select name="selFaculty" AUTOPOSTBACK = TRUE
>
onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val ue),
> populateCourse_from_Faculty(this.options[this.selectedIndex].value);">
>
> Would it be possible for you to point me in a direction of a code,
> which retrieves the data from the database, when selected item is auto
> posted? It is my very first asp page...
> Galina
>
> "Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in message news:<#n**************@TK2MSFTNGP11.phx.gbl>... > > Do you mean that when a user chooses faculty for example, the page is
posted > > back to the server to get the values for lists of lectures and courses? > > or Do you mean that all those values are taken from the database once
and > > client side script handles the case when the user makes his choices?
> >
> >
> > If you use the option of getting the data from the database at start and > > then a client side script would handle the choices of the user, the page
is > > not posted back unless the submit button is clicked. In this case, when
the > > user presses the back button, the web browser would return to the first
page > > and the choices won't be saved. If this is actually your scenario and
you > > want the back button to return to the choices the user made, then you
could > > make the list boxes post back (set AutoPostBackBack property to true)
and > > retrieve the data from the database in that event. This means that when
a > > user makes a choice in one of the listboxes, the request will be posted
to > > the server and the needed data is retrieved and returned to the client. > > This way would make the loading of the page quicker in the first time,
but > > would need make more roundtrips between the server and the user's browser > > when the user makes a selection from the list boxes.
> >
> > regards
> > Mohamed El Ashmawy
> > Microsoft GTSC Developer support for Middle East
> >
> > "Galina" <ga*********@cityofbristol.ac.uk> wrote in message
> > news:cc**************************@posting.google.c om...
> > > Hello
> > > I have 6 dependent list boxes on my ASP page:
> > >  Faculty;
> > >  Lecturer;
> > >  Course;
> > >  Course occurrence;
> > >  Group;
> > >  Week commencing date.
> > > When faculty is selected, lists of lecturers and courses are
> > > populated. When course is selected, lists of occurrences, groups and > > > dates are populated.
> > > All data to populate list boxes come from a database on SQL server, > > > from separate recordsets. List boxes are populated on the client side > > > using functions generated in the source, when asp page is processed on > > > the server side. An example:
> > > function populateLecturer_from_Faculty(Faculty) {
> > > prodBox1 = document.getSearch.selLecturer
> > > clearBox(prodBox1);
> > > switch (Faculty) {
> > >
> > > case 'ABT' :
> > > addBoxItem(prodBox1, ' ', '*');
> > >
> > > addBoxItem(prodBox1, 'Baxxr, V', '52');
> > >
> > > addBoxItem(prodBox1, 'Coxxly, M', '293');
> > >
> > > addBoxItem(prodBox1, 'Dxxn, T', '357');
> > >
> > > break;
> > >
> > > case 'BMP' :
> > > addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll, N',
> > > '4197');
> > >
> > > addBoxItem(prodBox1, 'Caxxde, J', '2779');
> > >
> > > addBoxItem(prodBox1, 'Vowxxs, C', '1279');
> > >
> > > break;
> > >
> > > case 'CHT' :
> > > addBoxItem(prodBox1, ' ', '*');
> > >
> > > addBoxItem(prodBox1, 'Bisxxp, E', '2763');
> > >
> > > addBoxItem(prodBox1, 'Brxxey, D, '172');
> > >
> > > break;
> > >
> > > case 'CLT' :
> > > addBoxItem(prodBox1, ' ', '*');
> > >
> > > addBoxItem(prodBox1, 'Garxxng, M', '471');
> > >
> > > addBoxItem(prodBox1, 'Waxxh, J', '1302');
> > >
> > > break;
> > >
> > > and so on.
> > >
> > > It is of course a very long source, but it works.
> > > When user selects everything, the selection uniquely identifies a
> > > group of students. When user clicks the button Submit, another asp
> > > page is activated showing room(s) occupied by this group on each day > > > of the selected week. It also works.
> > > My problem: when user clicks the button Back of the browser to return > > > to the selection asp page, the selection disappears. All list boxes > > > return to the full initial lists of faculties, lecturers, courses and > > > so on and the first item of each list is shown rather then that one > > > that was selected.
> > > Why does asp page changes, when user navigates back to it? How can I > > > prevent this change? I want my users to see the same data, when they > > > return to the page.
> > > The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000. (Being a > > > large college, we have PCs in different stages of Windows update.) The > > > problem looks the same on both browsers.
> > > Any help will be greatly appreciated.
> > > Thank you.
> > > Galina

Nov 18 '05 #7
The submit button actually submits the form (in contrast "button" that
doesn't do so).
Thus if you use the submit button, the form is submitted even before your
javascript is processed and the action poperty that you change in your
javascript code doesn't get processed before the form is submitted.
Howerver, when you use a normal "button", no submit occurs until you call
the submit method(<FormID>.submit) so you can control the order and have the
action property set before calling the submit method.

Best Regards and best of luck for you and your collegue
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East


"Galina" <ga****@mail.ru> wrote in message
news:ec*************************@posting.google.co m...
Great! Thank you very much! Luckily, I have already had a small java
script function - to check, what users enter. I have added commands
you recommend and yes, I get another form on the screen! Of course,
there is still plenty of work changing recordsets and code, if I
submit form every time user selects something, but I expect my asp
page to be simpler and faster with this method.

Interesting, that me and a collegue of mine have tried the 1st method
to re-direct to another form, but we used "Submit" type button, and it
didn't work. If you have a minute and it is easy to explain, why
"button" type button re-directs and "Submit" type button using the
same function doesn't?
Thank you once more. It is very kind of you to help such novices as
myself.

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<Od**************@TK2MSFTNGP10.phx.gbl>...
Anytime :)

I have 3 different ways in mind to make what you want:
1. You could make the submit button a normal button (use type="button"
instead of type="submit") and make its onclick event calls a javascipt
function.
The javscript function should check the event and then set the action
proprty of the form to the needed asp page whether it's the same page or
another one(<FormID>.action = "<WebPagePath>"); after that the javascript
function should call the submit method on the form (<FormID>.submit)

2. You could make the last select box in a different form and have a
separate submit button. This helps you make this new form have a different action and go to a different page. (This might not be appealing).

3. Make all events post to the same page and put a server side script at the very top of the page to check for the events that should send to other
pages. If you should send to another page, you could use response.redirect method (This solution is the least appealing because it posts back to the same page again then redirects to the other page in case of that event which is an overhead).

The best solution is the first one but it needs that you write some
javascript code (Very little though. About 5 or 6 lines of code only)

Regards
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

"Galina" <ga*********@cityofbristol.ac.uk> wrote in message
news:cc**************************@posting.google.c om...
Mohamed
Thank you for your help. I really appreciate it.
It is very interesting idea - to submit form to itself. A question:
with my 6 select boxes I'll submit the form to itself 5 times:
<form action=thesamepage.asp method=post>
Then, when something is selected in the very last box and user clicks
the button Submit, I need to pass information to another form. I am
sure it should be very simple, but I cannot find it, how to submit a
form to itself and, after certain event, to a different form?

4guysfromrolla site you recommend is very useful and very easy to
read.

Thank you once more.
Best Regards.
Galina

"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in

message news:<#u**************@TK2MSFTNGP11.phx.gbl>...
> Are you using ASP or ASP.net?
> If you are using ASP, then there is no AutoPostback property. In this
case,
> you should make each of the listboxes submit values to an asp page

(could be
> the same page) which get the values from the database (the usual
way you
> did before).
>
> I see from your code that you are using "select" which is an HTML

control,
> so it's better that you use the previous strategy in all cases
rather than
> using the AutoPostBack Property.
>
> In general the old code that you used before to connect to the
database > should suffice your need.
> A good ASP site that contains some tutorials is:
> http://www.4guysfromrolla.com
>
> Regards
> Mohamed El Ashmawy
> Microsoft GTSC Developer support for Middle East
>
> "Galina" <ga*********@cityofbristol.ac.uk> wrote in message
> news:cc**************************@posting.google.c om...
> > Mohamed
> > Thank you very much for your answer.
> >
> > I have set AutoPostBackBack property to true, I hope, correctly:
> > <select name="selFaculty" AUTOPOSTBACK = TRUE
> >
>

onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val
> ue),
> > populateCourse_from_Faculty(this.options[this.selectedIndex].value);"> > >
> > Would it be possible for you to point me in a direction of a code,
> > which retrieves the data from the database, when selected item is auto > > posted? It is my very first asp page...
> > Galina
> >
> > "Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in message news:<#n**************@TK2MSFTNGP11.phx.gbl>...
> > > Do you mean that when a user chooses faculty for example, the
page is
posted
> > > back to the server to get the values for lists of lectures and

courses?
> > > or Do you mean that all those values are taken from the database

once
and
> > > client side script handles the case when the user makes his
choices? > > >
> > >
> > > If you use the option of getting the data from the database at start and
> > > then a client side script would handle the choices of the user,
the page
is
> > > not posted back unless the submit button is clicked. In this
case, when
the
> > > user presses the back button, the web browser would return to
the first
page
> > > and the choices won't be saved. If this is actually your
scenario and
you
> > > want the back button to return to the choices the user made,
then you
could
> > > make the list boxes post back (set AutoPostBackBack property to

true)
and
> > > retrieve the data from the database in that event. This means
that when
a
> > > user makes a choice in one of the listboxes, the request will be

posted
to
> > > the server and the needed data is retrieved and returned to the

client.
> > > This way would make the loading of the page quicker in the first

time,
but
> > > would need make more roundtrips between the server and the
user's browser
> > > when the user makes a selection from the list boxes.
> > >
> > > regards
> > > Mohamed El Ashmawy
> > > Microsoft GTSC Developer support for Middle East
> > >
> > > "Galina" <ga*********@cityofbristol.ac.uk> wrote in message
> > > news:cc**************************@posting.google.c om...
> > > > Hello
> > > > I have 6 dependent list boxes on my ASP page:
> > > >  Faculty;
> > > >  Lecturer;
> > > >  Course;
> > > >  Course occurrence;
> > > >  Group;
> > > >  Week commencing date.
> > > > When faculty is selected, lists of lecturers and courses are
> > > > populated. When course is selected, lists of occurrences,
groups and
> > > > dates are populated.
> > > > All data to populate list boxes come from a database on SQL

server,
> > > > from separate recordsets. List boxes are populated on the
client side
> > > > using functions generated in the source, when asp page is

processed on
> > > > the server side. An example:
> > > > function populateLecturer_from_Faculty(Faculty) {
> > > > prodBox1 = document.getSearch.selLecturer
> > > > clearBox(prodBox1);
> > > > switch (Faculty) {
> > > >
> > > > case 'ABT' :
> > > > addBoxItem(prodBox1, ' ', '*');
> > > >
> > > > addBoxItem(prodBox1, 'Baxxr, V', '52');
> > > >
> > > > addBoxItem(prodBox1, 'Coxxly, M', '293');
> > > >
> > > > addBoxItem(prodBox1, 'Dxxn, T', '357');
> > > >
> > > > break;
> > > >
> > > > case 'BMP' :
> > > > addBoxItem(prodBox1, ' ', '*'); addBoxItem(prodBox1, 'Buxxll,
N', > > > > '4197');
> > > >
> > > > addBoxItem(prodBox1, 'Caxxde, J', '2779');
> > > >
> > > > addBoxItem(prodBox1, 'Vowxxs, C', '1279');
> > > >
> > > > break;
> > > >
> > > > case 'CHT' :
> > > > addBoxItem(prodBox1, ' ', '*');
> > > >
> > > > addBoxItem(prodBox1, 'Bisxxp, E', '2763');
> > > >
> > > > addBoxItem(prodBox1, 'Brxxey, D, '172');
> > > >
> > > > break;
> > > >
> > > > case 'CLT' :
> > > > addBoxItem(prodBox1, ' ', '*');
> > > >
> > > > addBoxItem(prodBox1, 'Garxxng, M', '471');
> > > >
> > > > addBoxItem(prodBox1, 'Waxxh, J', '1302');
> > > >
> > > > break;
> > > >
> > > > and so on.
> > > >
> > > > It is of course a very long source, but it works.
> > > > When user selects everything, the selection uniquely identifies a > > > > group of students. When user clicks the button Submit, another asp > > > > page is activated showing room(s) occupied by this group on

each day
> > > > of the selected week. It also works.
> > > > My problem: when user clicks the button Back of the browser to

return
> > > > to the selection asp page, the selection disappears. All list

boxes
> > > > return to the full initial lists of faculties, lecturers,
courses and
> > > > so on and the first item of each list is shown rather then
that one
> > > > that was selected.
> > > > Why does asp page changes, when user navigates back to it? How
can I
> > > > prevent this change? I want my users to see the same data,
when they
> > > > return to the page.
> > > > The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000.

(Being a
> > > > large college, we have PCs in different stages of Windows
update.) The
> > > > problem looks the same on both browsers.
> > > > Any help will be greatly appreciated.
> > > > Thank you.
> > > > Galina

Nov 18 '05 #8
Mohamed
Thank you. It is real pleasure to talk to you!
Galina
"Mohamed El Ashamwy" <mo***************@egdsc.microsoft.com> wrote in message news:<uW**************@TK2MSFTNGP11.phx.gbl>...
The submit button actually submits the form (in contrast "button" that
doesn't do so).
Thus if you use the submit button, the form is submitted even before your
javascript is processed and the action poperty that you change in your
javascript code doesn't get processed before the form is submitted.
Howerver, when you use a normal "button", no submit occurs until you call
the submit method(<FormID>.submit) so you can control the order and have the
action property set before calling the submit method.

Best Regards and best of luck for you and your collegue
Mohamed El Ashmawy
Microsoft GTSC Developer support for Middle East

Nov 18 '05 #9

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

Similar topics

0
by: Russ | last post by:
Hi, I have found myself wanting to use an HTMLSelect control instead of a DropDownList so that I can programatically set the item colours in the list (not possible with DropDownList due to...
5
by: Jim Cobban | last post by:
I am trying to create a web page in which the contents of one selection list depends upon which element in another selection list is chosen, but where the information to populate the first...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
10
by: Adam Clauss | last post by:
I have a page containing a list box. This list may contain duplicate items - in which the ORDER is important. ex: a b b a is significant as compared to: b
10
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: ZaphodBBB | last post by:
Hi (Windows XP Pro, MS Access 2003) I have a form that has quite a number of list boxes on it. The list boxes only have 3 or 4 selections possible...Pass, Fail, Average, Not...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
7
by: robtyketto | last post by:
Greetings, I'm slowly building up code to do the following:- Display TWO selection option boxes (cascading). If the FIRST selection option box changes then reload the jsp using onchange...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.