Extension talk:Maps/Future

Latest comment: 14 years ago by Jeroen De Dauw in topic Address strings for Form Inputs

Address strings for Form Inputs

edit

The Maps extension adds a "googlemaps" input type that can be used in forms. By default, this puts up a field where the user can enter an address to be geocoded and a button labled "Look Up Coordinates". When the user clicks the button, the resulting coordinate location is both displayed on a map and becomes the value for the associated field in the form that is using the googlemaps input type.

This is great, but there is currently no way to retrieve the address that was entered by the user. There are multiple scenarios where this would be useful, especially in situations where humans will be reading/editing pages with these forms again in the future.

This is a proposal for an extension to Maps/SM to provide this functionality, with the hope that this approach (or something else that meets the goal of making the entered address available to the form) can be implemented in Maps/SM.

There are two changes that would be required:

1) Add an input field property called "address field" that can be used on form fields of input type googlemaps, e.g.

{{{field | EventCoordinate | input type=googlemaps | address field=EventAddress}}}

2) Extend the action handler that is invoked when clicking on the "Look Up Coordinates" button to not only populate the field given for the coordinates, but also copy the entered address into the field named in the "address field" property.

Users then only need to add another field to their forms to hold the address ("EventAddress", in this example) and provide the "address field" property as shown above in order to get the address the user entered into their wiki pages.

-Al

Hey,

That's very interesting. Although this might be the easiest way to do what you want, from an user perspective it would be neater if the form only had the fields it has now. Instead of having the extra field to hold the address, it could be shown in the field with the "Look Up Coordinates" button next to it. I'm not sure if this can be done easily. Let's bug the forms guy (=Yaron) when he comes back from the death :)

Cheers

-- Jeroen De Dauw 11:01, 29 December 2009 (UTC)Reply

Jeroen,

The address is currently displayed (and entered) in the field with the button next to it. The problem is that this field only exists in the html form and used by the client-side javascript to hit the geocoding service, it doesn't correspond to any property back on the wiki page. When input type=googlemaps the geocoded coordinates are returned as the value (and put into the corresponding property), but the address that was entered by the user just disappears because it doesn't exist outside of the html form and javascript contexts.

I suppose the address could be concatenated on to the coordinates and the whole mess be returned as the single output value, but this would really complicate subsequent use of either the coords or the address. I think it would be the easiest if some way is found to get the two values back out to two different properties on the wiki page.


Thanks!

-Al

Hey,

I'd like to discuss your proposal with Yaron before any work in this direction is done. However, if you want to simply make the modifications as you think is best, that'd also be awesome :)

Cheers

-- Jeroen De Dauw 21:53, 30 December 2009 (UTC)Reply


Yeah, whenever I get a functioning platform again I had actually planned to dive in and see if I could implement this, then submit some patches. Problem right now is that the PHP 5.3.1 bug bit me because I had not seen the warnings about running with 5.2.12 instead, so I'm having to rebuild my dev system up from scratch to get all the right moving parts instead of just installing from a distro. Sigh... such is the way, I should know better... 8-)

-Al


1/7/2010: OK, I implemented the approach I was proposing for Google Maps (not Yahoo maps, yet), and sent the description/changes to Jeroen for review.

-Al

Return to "Maps/Future" page.