Thanks Chris for the answers. See inline. On Mon, Jun 6, 2011 at 3:06 AM, Chris Broadfoot <[email protected]> wrote:
> Comments inline. > > On Mon, Jun 6, 2011 at 9:58 AM, Gabriel Petrovay > <[email protected]>wrote: > >> Styling: >> How to provide class styling to the input fields? This is because the >> autocomplete code gives the input fields new class name: >> "pac-input-default". So, if the input had an initial class this is thrown >> away. What are some best practices to style such autocomplete-input-fields? >> > > Sounds like a bug! Sorry about that. I've filed this internally. > > For now, I suggest re-using our class to style your autocomplete fields. If > you need more granular control, you could use the HTML id attribute, or wrap > the <input> in a <div>. > That is exactly what I did to hack around it. .wrapperDiv input { ... } to simulate class-like behavior. And the id to give a style to it only for that element. > >> Hidden text input fields: >> If a text input fields is hidden: (the input is in a div that has the >> "display: none" style), the autocomplete code does not work anymore. If you >> look into the debug console you see that all the classes and elements are >> added but the completion proposals don't show up anymore. >> > > This sounds about right to me. Are you trying to show the suggestions > without the textbox? > Nope. The input field shows up either on request or if needed (geolocation not supported). > > >> Focus issues: >> And one more question. How can one get rid of the default text/change the >> default text: "Enter a location". This raises a problem is the focus is >> moved in the input field from code with jQuery. The default text is not >> deleted. >> > > This is another thing I've filed with the team, we should probably be using > the "placeholder" attribute here. > You can test it with jQuery using: addAutocompleteHandlers(); // which does the autocomplete api initialization $("#autocompleteInput").focus(); // => "Enter a location" is not deleted $("#autocompleteInput").val(""); // => "Enter a location" is not deleted either > Some more issues with the autocomplete feature: >> - since the proposal div is absolutely positioned, the resizing of the >> window keeps the div in place while the input field changes its position. (I >> know this is not a very common behavior of the user: resizing the browser >> during completion proposals) >> - the problem with the hidden text input fields is that the proposal div >> is rendered with a width of 0px and therefore not seen by the user. >> Moreover, because of the hidden input field also the position is messed-up, >> (top: 0px; left: 0px;), this being probably what it gets from the not >> visible input field. > > > This is probably because a hidden input has no width. Again, why are you > hiding the input? This is not an intended use case. > As the field is displayed lazily, the google.maps.places.Autocomplete was called $(document).ready() to install the necessary handlers. such that when the autocomplete input needs to be displayed, no more logic is necessary. Of course there are many dirsy workarrounds like using divs over the input field that hide the input field or a wrapper div with "overflow: hidden", etc. But I'd rather see a even nicer API. > > > >> And, is it safe to handle classes generated but such an API? >> For example I want to remove the pac-input-default class myself. Can I >> repy on such a name or is this error-prone since the names can change >> anytime? > > > Probably not. The names can change any time. Although I suggested re-using > it earlier in this mail, this should probably be a temporary measure until > the bug is fixed. > > Chris > > -- > http://twitter.com/broady > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > -- MSc Gabriel Petrovay Mobile: +41(0)787978034 www.28msec.com -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
