Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have read al the examples @tylerfrankenstein.com
The problem is all these examples work with the build in forms of drupalgap.
As tylersfankenstein says here https://www.drupal.org/node/2852527
Its better to create your own form.
I can build a form but can't seem to find how to save the input of the form to a node.
Could someone show an example of a custom form that is used to create a new node?
That would help me out a lot.
Thanks
Comments
Comment #2
GoempieK CreditAttribution: GoempieK commenteda bit more explaining of what i don't get.
The problem is i don't understand how i can go from a custom form to the json input needed by node_save.
http://docs.drupalgap.org/7/Forms/Creating_a_Custom_Form
Here the form is submit to an alert.
Now i would like to save the input to a new node, this should be done with Node save like this
I don't get how i can make the input of the form into the json var node shown above.
Feeling pretty dumb after 2 day's of searching.
Comment #3
GoempieK CreditAttribution: GoempieK commentedSolved.
The example code doesn't work because it says node.type instead of team.
Here it says default_value: node.type
Maybe make it clearer in the docs that you have to change this to the actual node type like below
Would have saved me a lot of ours, on the other hand i've learned a lot in my quest :-)
Comment #4
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI've glad this is working for you now. As you found, you can build the node JSON in your form's submit handler, then pass it along to the node_save() function.
You can either statically set your node's "type" value above, or you can dynamically place it in a hidden input field and grab its value from the form_state.values.
I'm glad you learned some good stuff along the way, enjoy!