jquery-locationpicker-plugin icon indicating copy to clipboard operation
jquery-locationpicker-plugin copied to clipboard

Clear on :focus

Open yansusanto opened this issue 8 years ago • 3 comments

First of all, thank you for creating such an awesome script.

I'd like to know if

  1. it is possible to clear the 'address' field on page load and
  2. assuming there are other input fields to fill, not submitting the form when we accidentally press 'Enter/Return'

What would be the best practice if I'd like to accomplish the above.

Thanks & have a good day.

;)

yansusanto avatar Nov 10 '16 11:11 yansusanto

Hi @yanseo! Thank you :)

First: It seems like issue #11; Code example:

$('#map').locationpicker({
   inputBinding: {
      locationNameInput: $('#input-address')
   },
   oninitialized : function (component) {
      $('#input-address').val('');
   }
});

Second: If i have fully understood your issue, that you need initialize another input field and grab just their value, but question consist of 'how i can programmatically autocomplete location' or 'what is correct behavior of program on accidentally press Enter' ?

Sumragen avatar Nov 10 '16 12:11 Sumragen

Thanks, Sumragen for your reply.

This doesn't work though, the map disappeared and no autosuggestion ;(

        $('#map').locationpicker({
            inputBinding: {
                locationNameInput: $('#input-address')
            },
            oninitialized : function (component) {
                $('#input-address').val('');
            }
            enableAutocomplete: true,
            onchanged: function (currentLocation, radius, isMarkerDropped) {
            }
        });

Am I missing something here?

PS: This is the working code for me but I need to clear the field first before I could add another address which is of course not so user-friendly

        $('#map').locationpicker({
            location: {
                latitude: 3.139003,
                longitude: 101.68685499999992
            },
            radius: 300,
            inputBinding: {
                latitudeInput: $('#map-latt'),
                longitudeInput: $('#map-long'),
                radiusInput: $('#map-radius'),
                locationNameInput: $('#input-address')
            },
            enableAutocomplete: true,
            onchanged: function (currentLocation, radius, isMarkerDropped) {
            }
        });

yansusanto avatar Nov 10 '16 14:11 yansusanto

Anybody have a solution for this?

jzucadi avatar Aug 22 '17 23:08 jzucadi