I have an issue.
a site that is long time running, already have various customisations to the node/add on homepage and an iOS app that requires me to make Drupalgap fit in (I can't alter the way the type/fields are set up.
we are using Gmaps and the locations picker to get locations from the users.
So I used form alter to change the inputs, I would like to archive that the user adds image, description and a category ( taxonomy) all is great and swell, except I want the user locations to be stored in the map location picker as it is required.
the alter form have these customisations:
form.elements.field_sted_location.und.locpick.user_latitude = {
type: 'hidden',
value:'_byhoest_map_user_latitude'
};
form.elements.field_sted_location.und.locpick.user_longitude = {
type: 'hidden',
value:'_byhoest_map_user_longitude'
};
but when I try to post a new subject I get the error (excuse my localisation):
[Error] Failed to load resource: the server responded with a status of 406 (Not Acceptable) (www.byhoest.dk, line 0)
[Log] {"form_errors":{"field_sted_location][und][0][locpick][user_latitude":"Feltet Breddegrad er obligatorisk.","field_sted_location][und][0][locpick][user_longitude":"Feltet L\u00e6ngdegrad er obligatorisk."}} (jdrupal-7.x-1.1.min.js, line 31)
so this is not the way to inject a variable into the form I suppose (?)
a working node posts this as JSON:
{
"vid": "4206",
"uid": "2682",
"title": "L\u00f8gkarse",
...
"field_sted_location": {
"und": [
{
"lid": "1265",
"name": "",
"street": "",
"additional": "",
"city": "",
"province": "",
"postal_code": "",
"country": "dk",
"latitude": "55.618411",
"longitude": "12.579332",
"source": "1",
"is_primary": "0",
"locpick": {
"user_latitude": "55.618411",
"user_longitude": "12.579332"
},
"province_name": "",
"country_name": "Danmark"
}
]
},
...
how do I get the value in properly into the locpick attribute ?
Comments
Comment #1
dan1eln1el5en CreditAttribution: dan1eln1el5en commentedComment #2
dan1eln1el5en CreditAttribution: dan1eln1el5en commentedComment #3
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedPlease share the links to the project pages for the Drupal contrib modules you are using to make this happen on your Drupal site. Then we'll see if the corresponding modules exist in DrupalGap.
Comment #4
dan1eln1el5en CreditAttribution: dan1eln1el5en commentedoh, well Let me have a look.
meanwhile you can see the page here: http://www.byhoest.dk/beta/#node_add_sted
i think it's basically Gmaps and Locations that are being used one for maps the other for locations (and the picker), after reading around I found that I need to upgrade the fields to use geofields in the future, but now I just need this little field to populate to have a working version 1
gmaps: https://www.drupal.org/project/gmap
Location: https://www.drupal.org/project/location
Comment #5
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThe location module for DrupalGap will need its
hook_field_widget_form()
andhook_assemble_form_state_into_field()
implemented. That will allow the widget to be displayed correctly on the node add/edit form, and then when it is submitted, it can properly assemble the JSON to POST to the server.https://github.com/signalpoint/location
http://api.drupalgap.org/
Comment #6
dan1eln1el5en CreditAttribution: dan1eln1el5en commentedok, I have Locations module installed in the drupal project, so shall I read your reply as there is something in it that needs updating or that I need to rewrite the code to make it work ? (if so could you give me a good link how to implement this ?)
Comment #7
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedYou need to install the Location module for DrupalGap, then implement the two hooks I mentioned previously in the Location module for DrupalGap. Use the DrupalGap API for reference, or other DrupalGap contrib modules that have implemented those hooks, are also good for reference.
Comment #8
dan1eln1el5en CreditAttribution: dan1eln1el5en commentedjust wanted to get back to you, I took _strong_ inspiration from geofields.js, here is the new location module in my app :)
(Note the localisation...)
Comment #9
tyler.frankenstein CreditAttribution: tyler.frankenstein commented@dan1eln1el5en, that looks amazing, nice work! Would you please fork the location module on GitHub, then commit and submit a pull request for your changes? That way the code contributions can be easily attributed to you. - https://github.com/signalpoint/location - or if you'd like to be an administrator of that project on github, let me know, thanks!
Comment #10
dan1eln1el5en CreditAttribution: dan1eln1el5en commentedhey Tyler,
would love to, but right now I need this app out of the door first, I starting to get the logic of the structures here.
I'm just going to post another question/issue, because I think I might have overlooked something...that would be fairly last thing to ensure I can send out a new beta tonight (CET time zone here)