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

G

Galina

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
 
M

Mohamed El Ashamwy

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
 
G

Galina

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.options[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
 
M

Mohamed El Ashamwy

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 said:
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.options[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" <[email protected]> wrote in
message news: said:
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
 
G

Galina

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 said:
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 said:
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.options[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" <[email protected]> wrote in
message news: said:
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

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
 
M

Mohamed El Ashamwy

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 said:
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" <[email protected]> wrote in
message news: said:
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 said:
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.options[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" <[email protected]> wrote in
message news: said:
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

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
 
G

Galina

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 said:
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 said:
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" <[email protected]> wrote in
message news: said:
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

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.options[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" <[email protected]> wrote in
message news: said:
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

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
 
M

Mohamed El Ashamwy

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 said:
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" <[email protected]> wrote in
message news: said:
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 said:
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" <[email protected]> wrote in
message news: said:
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

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.options[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" <[email protected]> wrote
in
message news: said:
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top