Connecting Tech Pros Worldwide Help | Site Map

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

Galina
Guest
 
Posts: n/a
#1: Nov 18 '05
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
Mohamed El Ashamwy
Guest
 
Posts: n/a
#2: Nov 18 '05

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


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" <galina.self@cityofbristol.ac.uk> wrote in message
news:cc765639.0401200301.2ce98ecd@posting.google.c om...[color=blue]
> 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[/color]


Galina
Guest
 
Posts: n/a
#3: Nov 18 '05

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


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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in message news:<#n5x7L23DHA.3216@TK2MSFTNGP11.phx.gbl>...[color=blue]
> 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" <galina.self@cityofbristol.ac.uk> wrote in message
> news:cc765639.0401200301.2ce98ecd@posting.google.c om...[color=green]
> > 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[/color][/color]
Mohamed El Ashamwy
Guest
 
Posts: n/a
#4: Nov 18 '05

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


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" <galina.self@cityofbristol.ac.uk> wrote in message
news:cc765639.0401210811.30718743@posting.google.c om...[color=blue]
> Mohamed
> Thank you very much for your answer.
>
> I have set AutoPostBackBack property to true, I hope, correctly:
> <select name="selFaculty" AUTOPOSTBACK = TRUE
>[/color]
onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val
ue),[color=blue]
> 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
message news:<#n5x7L23DHA.3216@TK2MSFTNGP11.phx.gbl>...[color=blue][color=green]
> > Do you mean that when a user chooses faculty for example, the page is[/color][/color]
posted[color=blue][color=green]
> > 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[/color][/color]
and[color=blue][color=green]
> > 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[/color][/color]
is[color=blue][color=green]
> > not posted back unless the submit button is clicked. In this case, when[/color][/color]
the[color=blue][color=green]
> > user presses the back button, the web browser would return to the first[/color][/color]
page[color=blue][color=green]
> > and the choices won't be saved. If this is actually your scenario and[/color][/color]
you[color=blue][color=green]
> > want the back button to return to the choices the user made, then you[/color][/color]
could[color=blue][color=green]
> > make the list boxes post back (set AutoPostBackBack property to true)[/color][/color]
and[color=blue][color=green]
> > retrieve the data from the database in that event. This means that when[/color][/color]
a[color=blue][color=green]
> > user makes a choice in one of the listboxes, the request will be posted[/color][/color]
to[color=blue][color=green]
> > 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,[/color][/color]
but[color=blue][color=green]
> > would need make more roundtrips between the server and the user's[/color][/color]
browser[color=blue][color=green]
> > when the user makes a selection from the list boxes.
> >
> > regards
> > Mohamed El Ashmawy
> > Microsoft GTSC Developer support for Middle East
> >
> > "Galina" <galina.self@cityofbristol.ac.uk> wrote in message
> > news:cc765639.0401200301.2ce98ecd@posting.google.c om...[color=darkred]
> > > 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[/color][/color][/color]


Galina
Guest
 
Posts: n/a
#5: Nov 18 '05

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


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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in message news:<#u7W4ap4DHA.1664@TK2MSFTNGP11.phx.gbl>...[color=blue]
> 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" <galina.self@cityofbristol.ac.uk> wrote in message
> news:cc765639.0401210811.30718743@posting.google.c om...[color=green]
> > Mohamed
> > Thank you very much for your answer.
> >
> > I have set AutoPostBackBack property to true, I hope, correctly:
> > <select name="selFaculty" AUTOPOSTBACK = TRUE
> >[/color]
> onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val
> ue),[color=green]
> > 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
> message news:<#n5x7L23DHA.3216@TK2MSFTNGP11.phx.gbl>...[color=green][color=darkred]
> > > Do you mean that when a user chooses faculty for example, the page is[/color][/color]
> posted[color=green][color=darkred]
> > > 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[/color][/color]
> and[color=green][color=darkred]
> > > 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[/color][/color]
> is[color=green][color=darkred]
> > > not posted back unless the submit button is clicked. In this case, when[/color][/color]
> the[color=green][color=darkred]
> > > user presses the back button, the web browser would return to the first[/color][/color]
> page[color=green][color=darkred]
> > > and the choices won't be saved. If this is actually your scenario and[/color][/color]
> you[color=green][color=darkred]
> > > want the back button to return to the choices the user made, then you[/color][/color]
> could[color=green][color=darkred]
> > > make the list boxes post back (set AutoPostBackBack property to true)[/color][/color]
> and[color=green][color=darkred]
> > > retrieve the data from the database in that event. This means that when[/color][/color]
> a[color=green][color=darkred]
> > > user makes a choice in one of the listboxes, the request will be posted[/color][/color]
> to[color=green][color=darkred]
> > > 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,[/color][/color]
> but[color=green][color=darkred]
> > > would need make more roundtrips between the server and the user's[/color][/color]
> browser[color=green][color=darkred]
> > > when the user makes a selection from the list boxes.
> > >
> > > regards
> > > Mohamed El Ashmawy
> > > Microsoft GTSC Developer support for Middle East
> > >
> > > "Galina" <galina.self@cityofbristol.ac.uk> wrote in message
> > > news:cc765639.0401200301.2ce98ecd@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[/color][/color][/color]
Mohamed El Ashamwy
Guest
 
Posts: n/a
#6: Nov 18 '05

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


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" <galina.self@cityofbristol.ac.uk> wrote in message
news:cc765639.0401270829.34829dfc@posting.google.c om...[color=blue]
> 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
message news:<#u7W4ap4DHA.1664@TK2MSFTNGP11.phx.gbl>...[color=blue][color=green]
> > Are you using ASP or ASP.net?
> > If you are using ASP, then there is no AutoPostback property. In this[/color][/color]
case,[color=blue][color=green]
> > you should make each of the listboxes submit values to an asp page[/color][/color]
(could be[color=blue][color=green]
> > the same page) which get the values from the database (the usual way[/color][/color]
you[color=blue][color=green]
> > did before).
> >
> > I see from your code that you are using "select" which is an HTML[/color][/color]
control,[color=blue][color=green]
> > so it's better that you use the previous strategy in all cases rather[/color][/color]
than[color=blue][color=green]
> > 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" <galina.self@cityofbristol.ac.uk> wrote in message
> > news:cc765639.0401210811.30718743@posting.google.c om...[color=darkred]
> > > Mohamed
> > > Thank you very much for your answer.
> > >
> > > I have set AutoPostBackBack property to true, I hope, correctly:
> > > <select name="selFaculty" AUTOPOSTBACK = TRUE
> > >[/color]
> >[/color][/color]
onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val[color=blue][color=green]
> > ue),[color=darkred]
> > > 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
> > message news:<#n5x7L23DHA.3216@TK2MSFTNGP11.phx.gbl>...[color=darkred]
> > > > Do you mean that when a user chooses faculty for example, the page[/color][/color][/color]
is[color=blue][color=green]
> > posted[color=darkred]
> > > > back to the server to get the values for lists of lectures and[/color][/color][/color]
courses?[color=blue][color=green][color=darkred]
> > > > or Do you mean that all those values are taken from the database[/color][/color][/color]
once[color=blue][color=green]
> > and[color=darkred]
> > > > 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[/color][/color][/color]
and[color=blue][color=green][color=darkred]
> > > > then a client side script would handle the choices of the user, the[/color][/color][/color]
page[color=blue][color=green]
> > is[color=darkred]
> > > > not posted back unless the submit button is clicked. In this case,[/color][/color][/color]
when[color=blue][color=green]
> > the[color=darkred]
> > > > user presses the back button, the web browser would return to the[/color][/color][/color]
first[color=blue][color=green]
> > page[color=darkred]
> > > > and the choices won't be saved. If this is actually your scenario[/color][/color][/color]
and[color=blue][color=green]
> > you[color=darkred]
> > > > want the back button to return to the choices the user made, then[/color][/color][/color]
you[color=blue][color=green]
> > could[color=darkred]
> > > > make the list boxes post back (set AutoPostBackBack property to[/color][/color][/color]
true)[color=blue][color=green]
> > and[color=darkred]
> > > > retrieve the data from the database in that event. This means that[/color][/color][/color]
when[color=blue][color=green]
> > a[color=darkred]
> > > > user makes a choice in one of the listboxes, the request will be[/color][/color][/color]
posted[color=blue][color=green]
> > to[color=darkred]
> > > > the server and the needed data is retrieved and returned to the[/color][/color][/color]
client.[color=blue][color=green][color=darkred]
> > > > This way would make the loading of the page quicker in the first[/color][/color][/color]
time,[color=blue][color=green]
> > but[color=darkred]
> > > > would need make more roundtrips between the server and the user's[/color]
> > browser[color=darkred]
> > > > when the user makes a selection from the list boxes.
> > > >
> > > > regards
> > > > Mohamed El Ashmawy
> > > > Microsoft GTSC Developer support for Middle East
> > > >
> > > > "Galina" <galina.self@cityofbristol.ac.uk> wrote in message
> > > > news:cc765639.0401200301.2ce98ecd@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[/color][/color][/color]
and[color=blue][color=green][color=darkred]
> > > > > dates are populated.
> > > > > All data to populate list boxes come from a database on SQL[/color][/color][/color]
server,[color=blue][color=green][color=darkred]
> > > > > from separate recordsets. List boxes are populated on the client[/color][/color][/color]
side[color=blue][color=green][color=darkred]
> > > > > using functions generated in the source, when asp page is[/color][/color][/color]
processed on[color=blue][color=green][color=darkred]
> > > > > 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[/color][/color][/color]
day[color=blue][color=green][color=darkred]
> > > > > of the selected week. It also works.
> > > > > My problem: when user clicks the button Back of the browser to[/color][/color][/color]
return[color=blue][color=green][color=darkred]
> > > > > to the selection asp page, the selection disappears. All list[/color][/color][/color]
boxes[color=blue][color=green][color=darkred]
> > > > > return to the full initial lists of faculties, lecturers, courses[/color][/color][/color]
and[color=blue][color=green][color=darkred]
> > > > > so on and the first item of each list is shown rather then that[/color][/color][/color]
one[color=blue][color=green][color=darkred]
> > > > > that was selected.
> > > > > Why does asp page changes, when user navigates back to it? How can[/color][/color][/color]
I[color=blue][color=green][color=darkred]
> > > > > prevent this change? I want my users to see the same data, when[/color][/color][/color]
they[color=blue][color=green][color=darkred]
> > > > > return to the page.
> > > > > The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000.[/color][/color][/color]
(Being a[color=blue][color=green][color=darkred]
> > > > > large college, we have PCs in different stages of Windows update.)[/color][/color][/color]
The[color=blue][color=green][color=darkred]
> > > > > problem looks the same on both browsers.
> > > > > Any help will be greatly appreciated.
> > > > > Thank you.
> > > > > Galina[/color][/color][/color]


Galina
Guest
 
Posts: n/a
#7: Nov 18 '05

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


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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in message news:<OdQD$0a5DHA.2480@TK2MSFTNGP10.phx.gbl>...[color=blue]
> 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" <galina.self@cityofbristol.ac.uk> wrote in message
> news:cc765639.0401270829.34829dfc@posting.google.c om...[color=green]
> > 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
> message news:<#u7W4ap4DHA.1664@TK2MSFTNGP11.phx.gbl>...[color=green][color=darkred]
> > > Are you using ASP or ASP.net?
> > > If you are using ASP, then there is no AutoPostback property. In this[/color][/color]
> case,[color=green][color=darkred]
> > > you should make each of the listboxes submit values to an asp page[/color][/color]
> (could be[color=green][color=darkred]
> > > the same page) which get the values from the database (the usual way[/color][/color]
> you[color=green][color=darkred]
> > > did before).
> > >
> > > I see from your code that you are using "select" which is an HTML[/color][/color]
> control,[color=green][color=darkred]
> > > so it's better that you use the previous strategy in all cases rather[/color][/color]
> than[color=green][color=darkred]
> > > 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" <galina.self@cityofbristol.ac.uk> wrote in message
> > > news:cc765639.0401210811.30718743@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
> > > >
> > >[/color][/color]
> onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val[color=green][color=darkred]
> > > 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color][/color]
> message news:<#n5x7L23DHA.3216@TK2MSFTNGP11.phx.gbl>...[color=green][color=darkred]
> > > > > Do you mean that when a user chooses faculty for example, the page[/color][/color]
> is
> posted[color=green][color=darkred]
> > > > > back to the server to get the values for lists of lectures and[/color][/color]
> courses?[color=green][color=darkred]
> > > > > or Do you mean that all those values are taken from the database[/color][/color]
> once
> and[color=green][color=darkred]
> > > > > 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[/color][/color]
> and[color=green][color=darkred]
> > > > > then a client side script would handle the choices of the user, the[/color][/color]
> page
> is[color=green][color=darkred]
> > > > > not posted back unless the submit button is clicked. In this case,[/color][/color]
> when
> the[color=green][color=darkred]
> > > > > user presses the back button, the web browser would return to the[/color][/color]
> first
> page[color=green][color=darkred]
> > > > > and the choices won't be saved. If this is actually your scenario[/color][/color]
> and
> you[color=green][color=darkred]
> > > > > want the back button to return to the choices the user made, then[/color][/color]
> you
> could[color=green][color=darkred]
> > > > > make the list boxes post back (set AutoPostBackBack property to[/color][/color]
> true)
> and[color=green][color=darkred]
> > > > > retrieve the data from the database in that event. This means that[/color][/color]
> when
> a[color=green][color=darkred]
> > > > > user makes a choice in one of the listboxes, the request will be[/color][/color]
> posted
> to[color=green][color=darkred]
> > > > > the server and the needed data is retrieved and returned to the[/color][/color]
> client.[color=green][color=darkred]
> > > > > This way would make the loading of the page quicker in the first[/color][/color]
> time,
> but[color=green][color=darkred]
> > > > > would need make more roundtrips between the server and the user's[/color][/color]
> browser[color=green][color=darkred]
> > > > > when the user makes a selection from the list boxes.
> > > > >
> > > > > regards
> > > > > Mohamed El Ashmawy
> > > > > Microsoft GTSC Developer support for Middle East
> > > > >
> > > > > "Galina" <galina.self@cityofbristol.ac.uk> wrote in message
> > > > > news:cc765639.0401200301.2ce98ecd@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[/color][/color]
> and[color=green][color=darkred]
> > > > > > dates are populated.
> > > > > > All data to populate list boxes come from a database on SQL[/color][/color]
> server,[color=green][color=darkred]
> > > > > > from separate recordsets. List boxes are populated on the client[/color][/color]
> side[color=green][color=darkred]
> > > > > > using functions generated in the source, when asp page is[/color][/color]
> processed on[color=green][color=darkred]
> > > > > > 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[/color][/color]
> day[color=green][color=darkred]
> > > > > > of the selected week. It also works.
> > > > > > My problem: when user clicks the button Back of the browser to[/color][/color]
> return[color=green][color=darkred]
> > > > > > to the selection asp page, the selection disappears. All list[/color][/color]
> boxes[color=green][color=darkred]
> > > > > > return to the full initial lists of faculties, lecturers, courses[/color][/color]
> and[color=green][color=darkred]
> > > > > > so on and the first item of each list is shown rather then that[/color][/color]
> one[color=green][color=darkred]
> > > > > > that was selected.
> > > > > > Why does asp page changes, when user navigates back to it? How can[/color][/color]
> I[color=green][color=darkred]
> > > > > > prevent this change? I want my users to see the same data, when[/color][/color]
> they[color=green][color=darkred]
> > > > > > return to the page.
> > > > > > The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000.[/color][/color]
> (Being a[color=green][color=darkred]
> > > > > > large college, we have PCs in different stages of Windows update.)[/color][/color]
> The[color=green][color=darkred]
> > > > > > problem looks the same on both browsers.
> > > > > > Any help will be greatly appreciated.
> > > > > > Thank you.
> > > > > > Galina[/color][/color][/color]
Mohamed El Ashamwy
Guest
 
Posts: n/a
#8: Nov 18 '05

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


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" <galkas@mail.ru> wrote in message
news:ecdc865.0402020724.2508592d@posting.google.co m...[color=blue]
> 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
message news:<OdQD$0a5DHA.2480@TK2MSFTNGP10.phx.gbl>...[color=blue][color=green]
> > 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[/color][/color]
javascript[color=blue][color=green]
> > 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[/color][/color]
different[color=blue][color=green]
> > 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[/color][/color]
the[color=blue][color=green]
> > 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[/color][/color]
response.redirect[color=blue][color=green]
> > method (This solution is the least appealing because it posts back to[/color][/color]
the[color=blue][color=green]
> > same page again then redirects to the other page in case of that event[/color][/color]
which[color=blue][color=green]
> > 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" <galina.self@cityofbristol.ac.uk> wrote in message
> > news:cc765639.0401270829.34829dfc@posting.google.c om...[color=darkred]
> > > 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" <mohamed.elashmawy@egdsc.microsoft.com> wrote in[/color]
> > message news:<#u7W4ap4DHA.1664@TK2MSFTNGP11.phx.gbl>...[color=darkred]
> > > > Are you using ASP or ASP.net?
> > > > If you are using ASP, then there is no AutoPostback property. In[/color][/color][/color]
this[color=blue][color=green]
> > case,[color=darkred]
> > > > you should make each of the listboxes submit values to an asp page[/color]
> > (could be[color=darkred]
> > > > the same page) which get the values from the database (the usual[/color][/color][/color]
way[color=blue][color=green]
> > you[color=darkred]
> > > > did before).
> > > >
> > > > I see from your code that you are using "select" which is an HTML[/color]
> > control,[color=darkred]
> > > > so it's better that you use the previous strategy in all cases[/color][/color][/color]
rather[color=blue][color=green]
> > than[color=darkred]
> > > > using the AutoPostBack Property.
> > > >
> > > > In general the old code that you used before to connect to the[/color][/color][/color]
database[color=blue][color=green][color=darkred]
> > > > 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" <galina.self@cityofbristol.ac.uk> wrote in message
> > > > news:cc765639.0401210811.30718743@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
> > > > >
> > > >[/color]
> >[/color][/color]
onChange="populateLecturer_from_Faculty(this.optio ns[this.selectedIndex].val[color=blue][color=green][color=darkred]
> > > > ue),
> > > > >[/color][/color][/color]
populateCourse_from_Faculty(this.options[this.selectedIndex].value);">[color=blue][color=green][color=darkred]
> > > > >
> > > > > 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[/color][/color][/color]
auto[color=blue][color=green][color=darkred]
> > > > > posted? It is my very first asp page...
> > > > > Galina
> > > > >
> > > > > "Mohamed El Ashamwy" <mohamed.elashmawy@egdsc.microsoft.com> wrote[/color][/color][/color]
in[color=blue][color=green]
> > message news:<#n5x7L23DHA.3216@TK2MSFTNGP11.phx.gbl>...[color=darkred]
> > > > > > Do you mean that when a user chooses faculty for example, the[/color][/color][/color]
page[color=blue][color=green]
> > is
> > posted[color=darkred]
> > > > > > back to the server to get the values for lists of lectures and[/color]
> > courses?[color=darkred]
> > > > > > or Do you mean that all those values are taken from the database[/color]
> > once
> > and[color=darkred]
> > > > > > client side script handles the case when the user makes his[/color][/color][/color]
choices?[color=blue][color=green][color=darkred]
> > > > > >
> > > > > >
> > > > > > If you use the option of getting the data from the database at[/color][/color][/color]
start[color=blue][color=green]
> > and[color=darkred]
> > > > > > then a client side script would handle the choices of the user,[/color][/color][/color]
the[color=blue][color=green]
> > page
> > is[color=darkred]
> > > > > > not posted back unless the submit button is clicked. In this[/color][/color][/color]
case,[color=blue][color=green]
> > when
> > the[color=darkred]
> > > > > > user presses the back button, the web browser would return to[/color][/color][/color]
the[color=blue][color=green]
> > first
> > page[color=darkred]
> > > > > > and the choices won't be saved. If this is actually your[/color][/color][/color]
scenario[color=blue][color=green]
> > and
> > you[color=darkred]
> > > > > > want the back button to return to the choices the user made,[/color][/color][/color]
then[color=blue][color=green]
> > you
> > could[color=darkred]
> > > > > > make the list boxes post back (set AutoPostBackBack property to[/color]
> > true)
> > and[color=darkred]
> > > > > > retrieve the data from the database in that event. This means[/color][/color][/color]
that[color=blue][color=green]
> > when
> > a[color=darkred]
> > > > > > user makes a choice in one of the listboxes, the request will be[/color]
> > posted
> > to[color=darkred]
> > > > > > the server and the needed data is retrieved and returned to the[/color]
> > client.[color=darkred]
> > > > > > This way would make the loading of the page quicker in the first[/color]
> > time,
> > but[color=darkred]
> > > > > > would need make more roundtrips between the server and the[/color][/color][/color]
user's[color=blue][color=green]
> > browser[color=darkred]
> > > > > > when the user makes a selection from the list boxes.
> > > > > >
> > > > > > regards
> > > > > > Mohamed El Ashmawy
> > > > > > Microsoft GTSC Developer support for Middle East
> > > > > >
> > > > > > "Galina" <galina.self@cityofbristol.ac.uk> wrote in message
> > > > > > news:cc765639.0401200301.2ce98ecd@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,[/color][/color][/color]
groups[color=blue][color=green]
> > and[color=darkred]
> > > > > > > dates are populated.
> > > > > > > All data to populate list boxes come from a database on SQL[/color]
> > server,[color=darkred]
> > > > > > > from separate recordsets. List boxes are populated on the[/color][/color][/color]
client[color=blue][color=green]
> > side[color=darkred]
> > > > > > > using functions generated in the source, when asp page is[/color]
> > processed on[color=darkred]
> > > > > > > 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,[/color][/color][/color]
N',[color=blue][color=green][color=darkred]
> > > > > > > '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[/color][/color][/color]
identifies a[color=blue][color=green][color=darkred]
> > > > > > > group of students. When user clicks the button Submit, another[/color][/color][/color]
asp[color=blue][color=green][color=darkred]
> > > > > > > page is activated showing room(s) occupied by this group on[/color][/color][/color]
each[color=blue][color=green]
> > day[color=darkred]
> > > > > > > of the selected week. It also works.
> > > > > > > My problem: when user clicks the button Back of the browser to[/color]
> > return[color=darkred]
> > > > > > > to the selection asp page, the selection disappears. All list[/color]
> > boxes[color=darkred]
> > > > > > > return to the full initial lists of faculties, lecturers,[/color][/color][/color]
courses[color=blue][color=green]
> > and[color=darkred]
> > > > > > > so on and the first item of each list is shown rather then[/color][/color][/color]
that[color=blue][color=green]
> > one[color=darkred]
> > > > > > > that was selected.
> > > > > > > Why does asp page changes, when user navigates back to it? How[/color][/color][/color]
can[color=blue][color=green]
> > I[color=darkred]
> > > > > > > prevent this change? I want my users to see the same data,[/color][/color][/color]
when[color=blue][color=green]
> > they[color=darkred]
> > > > > > > return to the page.
> > > > > > > The browser is IE 5.5 on Windows 9x and 6.0. on Windows 2000.[/color]
> > (Being a[color=darkred]
> > > > > > > large college, we have PCs in different stages of Windows[/color][/color][/color]
update.)[color=blue][color=green]
> > The[color=darkred]
> > > > > > > problem looks the same on both browsers.
> > > > > > > Any help will be greatly appreciated.
> > > > > > > Thank you.
> > > > > > > Galina[/color][/color][/color]


Galina
Guest
 
Posts: n/a
#9: Nov 18 '05

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


Mohamed
Thank you. It is real pleasure to talk to you!
Galina
"Mohamed El Ashamwy" <mohamed.elashmawy@egdsc.microsoft.com> wrote in message news:<uWgUfvk6DHA.2404@TK2MSFTNGP11.phx.gbl>...[color=blue]
> 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
>
>
>
>[/color]
Closed Thread