I have create application form i need an assistant with Javascript for 4 cascading drop-down list, i also need assistant with membership_no input i want the input to be exactly 16 character, and lastly i want the expiry input to calculate 12 month on the the creation date and that will be the value for input expiry_timestamp
Country: <select name="country" id="country">
<option>Select Country</option>
<option>Botswana</option>
<option>Lesotho</option>
<option>Namibia</option>
<option>South Africa</option>
<option>Swaziland</option>
<option>International</option>
</select> <br>
Province: <select id="province" name="province" class=""></select><br>
City: <select id="city" name="city" class=""></select><br>
Branch: <select id="province" name="branch" class=""></select><br>
Membership No: <input type="text" name="membership_no" ><br>
Start Date: <input type="text" name="creation_timestamp" value="<?php echo date ('m/d/Y');?>"><br>
Expiry Date: <input type="text" name="expiry_timestamp" value="<?php echo date ('');?>"><br>
<script>
jQuery(function($) {
var provinces = {
'Botswana': ['Central District', 'Ghanzi District', 'Kgalagadi District', 'Kgatleng District', 'Kweneng District', 'North-East District', 'Ngamiland District', 'South-East District', 'Southern District', 'Gaborone City', 'Francistown City of', 'Lobatse Town', 'Selebi-Phikwe Town', 'Jwaneng Town', 'Sowa Township'],
'Lesotho': ['Berea District', 'Butha Buthe District', 'Mafeteng District', 'Maseru District', 'Mohales Hoek District', 'Leribe District', 'Mokhotlong District', 'Thaba Tseka District', 'Qachas Nek District', 'Quthing District'],
'Namibia': ['Erongo', 'Hardap', 'Kavango East & Kavango West Region', 'Karas', 'Khomas', 'Kunene', 'Ohangwena', 'Omaheke', 'Omusati', 'Oshana', 'Oshikoto', 'Otjozondjupa', 'Zambezi'],
'South Africa': ['Eastern Cape', 'Free State', 'Gauteng', 'Kwa-Zulu Nata', 'Limpopo', 'Mpumalanga', 'North West', 'Northern Cape', 'Western Cape'],
'Swaziland': ['Swaziland'],
'International': ['International'],
}
var $provinces = $('#province');
$('#country').change(function () {
var country = $(this).val(), lcns = provinces[country] || [];
var html = $.map(lcns, function(lcn){
return '<option value="' + lcn + '">' + lcn + '</option>'
}).join('');
$provinces.html(html)
});
});
</script>
Here is what i want the cascading drop-down look like and my current javascript only cascading on two input i want to change it to four Country
Botswana Lesotho South Africa International
Province Central District', 'Ghanzi District', 'Kgalagadi District Berea District', 'Butha Buthe District', 'Mafeteng District' Gauteng, Zulu Natal, Western Cape International
City
Barea [Maseru, Leba], Ghanzi District [Lebone, Bokone] Gauteng [Johannesburg, Pretoria], Zulu natal [Durban, Port], Western [Cape Town, Kimberly]
Branch Maseru [uba, Lese], Bokone[Lesetlhe, Section],
cascading dropdown list in javascript Country:
No comments:
Post a Comment