File: D:/HostingSpaces/SBogers10/immoginis.komma.pro/wwwroot/js/form.js
/**
* Created by Pascal on 07/04/16.
*/
// This example displays an address form, using the autocomplete feature
// of the Google Places API to help users fill in the information.
// This example requires the Places library. Include the libraries=places
// parameter when you first load the API. For example:
/*var autocomplete;
function initialize() {
var options = {
types: ['(cities)'],
componentRestrictions: {country: "be"},
language: 'nl'
};
var input = document.getElementById('autocomplete');
autocomplete = new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
fillInAddress();
});
}
google.maps.event.addDomListener(window, 'load', initialize);
function fillInAddress() {
var place = autocomplete.getPlace();
document.getElementById("cityField").value = place.address_components[0].long_name;
//postalField
}*/
$('#autocomplete').change(function () {
if ($(this).val() == '') $('#cityField').val('')
})
$("#autocomplete").keydown(function (e) {
if (e.which == 13) {
//Set the timetout so the autocomplete can be filled in
setTimeout(function () {
$('#selectForm').submit();
}, 200);
//Prevent the default
e.preventDefault();
}
});
$(function () {
$('#min_price').selectric({
onInit: function(){
$('#priceField .before').remove();
$('#priceField .arrow').remove();
},
/*onChange: function () {
$('#min_price_get').html($('#min_price option')[$(this).prop('selectedIndex')].value);
if(($(this).prop('selectedIndex')>= $('#max_price').prop('selectedIndex')) && ($('#max_price').prop('selectedIndex') != 0) ){
var newValue = $(this).prop('selectedIndex')+1;
if(newValue >= $('#max_price option').length){
newValue = 0;
}
$('#max_price').prop('selectedIndex', newValue).selectric('refresh');
}
}*/
});
$('#typeSelectField').selectric();
$('#max_price').selectric({
onInit: function(){
$('#priceField .before').remove();
$('#priceField .arrow').remove();
},
/*onChange: function () {
$('#max_price_get').html($('#max_price option')[$(this).prop('selectedIndex')].value);
if($(this).prop('selectedIndex')<= $('#min_price').prop('selectedIndex') && ($('#min_price').prop('selectedIndex') != 0)){
var newValue = $(this).prop('selectedIndex')-1;
if(newValue <= -1){
newValue = 0;
}
$('#min_price').prop('selectedIndex', newValue).selectric('refresh');
}
}*/
});
$('#cityField').selectric({
onOpen: function() {
$('#locationField .selectric-wrapper>.selectric ').css('pointer-events', 'none');
},
onClose: function() {
$('#locationField .selectric-wrapper>.selectric ').css('pointer-events', 'all');
},
});
$('#citySetField').selectric({
onOpen: function() {
$('#locationField .selectric-wrapper>.selectric ').css('pointer-events', 'none');
},
onClose: function() {
$('#locationField .selectric-wrapper>.selectric ').css('pointer-events', 'all');
},
});
$('#goal_property').selectric({
onOpen: function() {
$('#priceField .selectric-wrapper>.selectric ').css('pointer-events', 'none');
},
onClose: function() {
$('#priceField .selectric-wrapper>.selectric ').css('pointer-events', 'all');
},
});
});