hi all

i have 2 node types. city & bars. i have a couple of cities, and bars which have a node reference field for city. so when i want to create a new bar to display on my gmap view from that city, i can choose the city from a drop down which is populated by the node reference (all the city names). so if i create a new city, it appears in the drop down. this to limit to which city people can add bars to.
but to be able to get the location/gmap working i still need to fill in the location field for city. so it can look up the long/latitudes. only a street isn't enough.

is it possible to populate the location field for city by which city you choose from the node reference dropdown ?

Comments

yesct’s picture

I know I have used location_load_location() and node_load() (or was it load_node?) maybe you can use those with something like mylocation['city']=$cityfrompulldown; node_save($id) or. Location_save_location() or ???

I really don't know, but maybe my guesses will inspire someone who does know.

Is something like Ajax needed?

This reminds me slightly of the idea of defaults for states and cities, and while this is not the same, you might want to search the location issue queue. See if any of the issues tagged "location defaults" have any code that inspires you. If so, please link to themfrom here.

ankur’s picture

Status: Active » Closed (won't fix)

As a narrow, one-off use case, this would probably be better served by a custom solution that makes use of hook_form_alter() and a custom #autocomplete_path value.