// Set default focus setAllFocusMethods(); document.getElementById('country_id').focus(); function trim(s) { return s.replace(/^\s*/, "").replace(/\s*$/, ""); } function validateForm() { var loc = false; var cty = false; var ss = false; var location = document.getElementById('location_id'); var country = document.getElementById('country_id'); var searchString = document.searchForm.searchString; if(country != null && country.value != "") cty = true; if(location != null && location.value != "") loc = true; if(searchString != null && searchString.value != "") ss = true; ok = (loc || cty || ss) if(!ok) { alert("Enter some text in the search box"); document.searchForm.searchString.focus(); return false; } return true; } function countryChanged() { var country = document.getElementById('country_id'); var cid = country.value; loadLocations(cid); document.getElementById('searchString').value = ""; } function loadLocations(country_id) { var url = "/widget/locationList" url = url + "/" + country_id; url = url + "?caching=true"; async(url,function(req) { var html = req.responseText; var locations = document.getElementById('locationDiv'); locations.innerHTML = html; setAllFocusMethods(); locationChanged(); document.getElementById('location_id').focus(); } ); } function locationChanged() { document.getElementById('searchString').value = ""; } function searchStringChanged() { document.getElementById('country_id').value = ""; document.getElementById('location_id').value = ""; }