I have a jQuery map that I've built that allows users to select states and counties. This is all done in Javascript. I would like to, on form submit, take this data and submit it to the user's profile2.

Should I create an empty form element and fill it somehow? It seems like there wouldn't be a way to pass any information to a form that happened after page creation.


Is this map that you created already in place? Were/are you utilizing it on the user's edit info page or somewhere else on the site?

You may want to consider instead using something like Geofield: https://www.drupal.org/project/geofield

This would allow user map input (on an OpenLayers map) via a new field that you can attach to the User entity (or any fieldable entity) and would collect the data into a "Drupal" way, freeing you up to focus on how to display the information, as opposed to doing a custom POST action using JS to your Drupal site, which could be time-consuming.

If you are looking to do this in JavaScript, you may want to consider the Services module, which would allow you to access your site's CRUD actions, therefore editing the information on a User's profile, but this means that you'd have to have to include a field to collect this information on the User entity anyways, at which point having a Geofield may be useful to you.

  • I'm using it in user registration, though they'll also be able to edit it on their user edit page too. It'll save taxonomy terms associated with the various locations. I'd like to do it in a similar way to hierarchical select, but I can't quite figure out how they're saving data. – Jack Ryan Aug 18 '14 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.