Skip to content

Error in AutoComplete #243

@vipul-mykaarma

Description

@vipul-mykaarma

Hi all,
I am getting the error

places_impl.js:30 Uncaught TypeError: Cannot read property 'trim' of undefined
at V9 (places_impl.js:30)
at O9._.r.vm (places_impl.js:61)

`

	AutocompleteType[] types = new AutocompleteType[1];
	types[0] = AutocompleteType.LOCALITY;
	AutocompleteOptions options = AutocompleteOptions.newInstance();
    options.setTypes(types);
	final Autocomplete autoComplete = Autocomplete.newInstance(
			tb.getElement(), options);
	
	 autoComplete.addPlaceChangeHandler(new PlaceChangeMapHandler() {
            public void onEvent(PlaceChangeMapEvent event) {
                PlaceResult result = autoComplete.getPlace();
                
                //result.getGeometry().getLocation().ge
                tb.setValue(result.getName());
            }
        });
	 
	 tb.addKeyDownHandler(new KeyDownHandler() {           
            @Override
            public void onKeyDown(KeyDownEvent event) {             
                if(event.getNativeKeyCode() == KeyCodes.KEY_ENTER){
                    GWT.log("Blocking form submit for autocomplete text box");
                    event.preventDefault();
                }
            }
        });`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions