1

Topic: The filter dependent select option

Good afternoon! Is 2 select option:

<%Set rsRegions = dbS.Execute ("SELECT IDRegion, IDProvince, RegionFullName FROM Regions ORDER BY RegionFullName ASC") %>
<tr>
<td class=sum_r> Area: </td>
<td>
<%
sSQL = "SELECT P.IDProvince, P.ProvinceFullNameRU" &_
"FROM Provinces P" &_
"WHERE P.IDProvince <> 1" &_
"ORDER BY P.ProvinceFullNameRU"
exec rs, dbS, sSQL
%>
<select name = "IDProvince" id ='IDProvince ' class = "fld" style = "width:200;">
<option value = ' 1 '> - </option>
<% do until rs.eof
sSelected = sl (IDProvince = azero (rs ("IDProvince")))
wr "<option value = '" BOTH rs ("IDProvince") AND "'" AND sSelected AND ">"
wr KZ (rs ("ProvinceFullNameRU"))
wr "</option>"
rs. MoveNext ()
loop
%>
</select>
</td>
<td class=sum_r> Region: </td>
<td> <select <% =strAccess %> class=fld name = "IDRegion" style = "width:130;" <% if CStr (idbelong) <> "1" then %> disabled <% end if %>>
<% do until rsRegions.eof %>
<option value = "<% = rsRegions. Fields (" IDRegion ") %>" <%if CStr (rsRegions. Fields ("IDRegion")) =CStr (IDRegion) then %> selected <%end if %>>
<% =rsRegions. Fields ("RegionFullName") %> </option>
<% rsRegions. MoveNext ()
loop %>
</select>
</td>
</tr>

Prompt how it is possible to filter regions depending on the selected area, a sheaf of tables Provinces. IDProvince = Regions. IDProvince (without page reboot).

2

Re: The filter dependent select option

With the help javascript on the client.
Is better ask a question on  on ASP.NET

3

Re: The filter dependent select option

It is old ASP

4

Re: The filter dependent select option

very _;
[spoiler Just in case]

<! DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<style>
#first, #second {width:140px;}
#fon {
margin:10px 0; width:400px; height:400px;
background-size:contain;
background-repeat:no-repeat;
}
</style>
</head>
<body>
<select id = "first"> </select>
<select id = "second"> </select>
<div id = "fon"> </div>
<script>
' use strict ';
function gid (i) {return document.getElementById (i);}
function init () {
var list = {
first: [' it is not selected ', ' Cars ', ' Computers ', ' Acquaintance '];
second: {
1: [' it is not selected ', ' BMW X5 ', ' Jaguar F5 ', ' Lamborgini Italian '];
2: [' it is not selected ', ' Windows', ' Mac ', ' Linux '];
3: [' it is not selected ', ' Love ', ' Meeting ', ' Sex ']
};
fon: {
1: [", ' https://www.kolesa.ru/uploads/2018/02/BMW-X5-new-front2-mini-630x380.jpg ', ' http://i.ndtvimg.com/i/2014-03/625x300_81394184251.jpg ', ' https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRrfZZ4qjixHPyk3QMeWyyvLSOQTdLx6QAnaPaPKTAFbj5KJFzMmA '];
2: [", ' https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSBwUhLVXLt3kEKgec6eR9bS5ZKRoJ_OjNIRiW9ePg2WI9vDazi ', ' https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR32x7QVNYu8aslMCISUHdYrPhB-UkMcm3Q02SKOyDjXiUN4UD9 ', ' http://shkola-linux.ru/images/stories/gos-main-rocket-splash.jpg '];
3: [", ' https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRejXGRl0vWTK3wyc58lUAwHkIBfCH7U1PCf2zlDqSJxF7YmJL0dg ', ' https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSq8dFS_qsmiHWPNSnsLpy76OzddVjBIR5C5JllOcCslNtykwyaVw ', ' http://icons.iconarchive.com/icons/google/noto-emoji-symbols/512/73031-prohibited-icon.png ']
}
}
var sid = ' first ', first = gid (sid), cnt = list [sid].length, i=0;
first.options.length = 0;
for (i=0; i <cnt; i ++) {first.options [i] = new Option (list [sid] [i], i);}
first.onchange = function () {
sid = ' second ';
var second = gid (sid), cnt = list [sid] [this.value].length;
second.options.length = 0;
for (i=0; i <cnt; i ++) {
second.options [i] = new Option (list [sid] [this.value] [i], i);
}
second.style.display = ' inline-block ';
second.onchange ();
}
second.onchange = function () {
sid = ' fon ';
var fon = gid (sid);
fon.style.backgroundImage = ' url ("' + list [sid] [first.value] [this.value] + '") ';
}
}
document.body.onload = init;
</script>
</body>
</html>

[/spoiler]

5

Re: The filter dependent select option

SQLPowerUser;
Thanks!

6

Re: The filter dependent select option

Konst_One;
Why the old? Than new differs?

7

Re: The filter dependent select option

ASP is actually VBScript on the server
ASP.NET is a platform on a. net Framework (C#, VB.NET)
Possibilities and implementation differ strongly. ASP.NET is more modern decision.

8

Re: The filter dependent select option

very _ wrote:

Konst_One;
Why the old? Than new differs?

https://ru.wikipedia.org/wiki/Active_Server_Pages#

9

Re: The filter dependent select option

Konst_One, clearly, thanks