CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Other Programming Languages: Javascript:
combo box+ Perl+JS

 



elavv2003
New User

Jul 10, 2008, 11:53 PM

Post #1 of 1 (22528 views)
combo box+ Perl+JS Can't Post

Hello wisdoms, Please have a glance on my following querry and attached reference files. I need to make three combo box which are related to each other.When the user choose the Continents,the specified countries should be displayed in the pull down menu.For each countries we have facilities in the database,that facilities should be displayed in the third pull down menu. I Have the script for the first two combo boxes.No issues...When i tried to link the third box through OnChange JavaScript function,there is null values in the second box itself. we tried to bring the solution through the following Perl scripts . ISSUES: Now when the user choose a country,the final country in the continent is displayed as selected ie the following country override the previous one...Example..the Turkey country is displayed as selected country what ever we choose in the Europe Region........ Please guys ....I searched a lot in the Perl as well as JavaScripts Forums.........Let ur valuable suggestion may bring a better solution to this issue......Help me............Thanks......... ##########################################

my %Regions = (
Europe =>[
'Belgium',
'Denmark',
'France',
'Germany',
'Great Britain',
'Hungary',
'Portugal',
'Russia',
'Spain',
'Sweden',
'Turkey',
],
Asia => [
'Australia',
'China',
'India',
'Malaysia',
'NewZealand',
'Philippines',
'South Africa',
'Taiwan',
'Vietnam',
],
North => [
'U.S.',
'Canada',
'Mexico',
],

South => [
'Argentina',
'Brazil',
'Venezuela',
],
);

foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[0]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Belgium" $selected >Belgium</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[1]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Denmark" $selected >Denmark</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[2]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="France" $selected >France</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[3]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Germany" $selected >Germany</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[4]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Great Britain" $selected >Great Britain</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[5]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Hungaryk" $selected >Hungary</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[6]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Portugal" $selected >Portugal</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[7]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Russia" $selected >Russia</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[8]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Spain" $selected >Spain</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[9]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Sweden" $selected >Sweden</option>
~;foreach my $region ( keys %Regions ) { if($region eq 'Europe') {$country_code="$Regions{$region}[10]"; my $selected="selected";}else{$selected="";}}
print qq ~ <option value="Turkey" $selected >Turkey</option>
######################################################
Attachments: combo_body.txt (1.89 KB)
  combo_js.txt (1.56 KB)
  combo_Perl_code.txt (2.81 KB)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives