Score:0

Prepopulate fields from json

ao flag

I am looking to prepopulate a page full of fields (not webform) from a json file. There are a lot of fields on the page and some of them contain a lot of info, so it doesnt appear that it is practical to use the prepopulate module. https://www.drupal.org/project/prepopulate

I have a rather long form that the user needs to fill in, but they likely already have the required info in a file on their pc. To save them manually filling it in, the user will upload a file which will then be processed (externally) and a json will be returned. The form will then be filled in automatically based on the processed results. Some of these fields are paragraphs with multiple fields.

If possible it would be ideal if this can be done without drupal module development. I've looked at how this can be done with js and possibly some python on the server side, but I'm still a little lost when it comes to how drupal handles these things.

Any guidance on where to go?

in flag
This is pretty vague. Can you share some sample data and/or code or other specifics?
yuuuu avatar
ao flag
@Beau It is somewhat vague at the moment because I don't know where to look. The 2nd para explains the entire journey I'm trying to achieve. Either the user can fill out the form themselves, or they can upload a file which will then be processed externally and the form will be filled in for them (and they can tweak it if needed). I just don't know how to achieve this or where to look for help. I edited OP to hopefully explain a little better
Kevin avatar
in flag
I don't understand how you want to populate a Drupal form with Python or without a custom module. A module is certainly required here to fill in your custom logic.
in flag
Take a look at the Feeds module and the Feeds Extensible Parser module. You shouldn't need to do anything with Python or any other external processing. This also sounds like a great use-case for Webform, as well, which can be auto-populated and, as a bonus, you can manage your webforms via YAML, if you want.
yuuuu avatar
ao flag
Just noticed I never replied. Thanks @Beau feeds extensible parser was exactly what I was looking for.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.