Closed dacom-dark-sun closed 7 years ago
Could you post your mysql table schema and model class source code ?
Im sorry for long answer, but actually it is my mistake with validation rules. Your widget words perfectly, but one question more: How i can bind click event for get coordinates, that use not use drag and drop principle?
@dacom-dark-sun
it's very easy, you can get the hidden input value
alert($('#locationpicker-coordinates').val() );
@dacom-dark-sun
Oh . . I misunderstand what you mean
I need read jquery-locationpick or google map document how to do that
Try it
$js = '
function(c){
var map = jQuery(c).locationpicker("map").map;
google.maps.event.addListener(map, "click", function(e) {
var marker = jQuery(c).locationpicker("map").marker;
var pos = e.latLng;
jQuery(c).locationpicker("location" , {latitude: pos.lat(), longitude: pos.lng()});
google.maps.event.trigger(marker, "dragend");
// e.stopPropagation();
});
};
then in the CoordinatesPicker add oninitialized event
'clientOptions' => [
'addressFormat' => 'street_number',
'radius' => 300,
'oninitialized' => new JsExpression($js),
],
Ok, thank you very much!) i will try it ASAP..
Can i disable auto-render default location? For.. not render any markers by default, but if user click or choice some place, model must receive coordinates.. Cause not every place need mark location from user, but if we have default position, this is can create some confusion..
I think it possible ,
Options has a "markerVisible" can be set to false.
You can read all options from document http://logicify.github.io/jquery-locationpicker-plugin and try to implement your event.
Thanks a lot, i was solve it: jQuery(c).locationpicker("map").marker.visible = true; and load by default with false.
I use example for back coordinates to model, but always receive a null. Code:
In model:
... { public $coordinates; .. ..
What problem can be here?