(Note that I am not talking about simply hiding/displaying fields conditional upon other fields' values.)

This question about programmatically creating fields led to questions about whether it was even possible to do what I want. See, I want to create a set of webforms that I will use as quizzes. Then I want to create a node of type "answer key" for each quiz. The answer key will be connected to a quiz by a node reference field. Upon selection of a quiz from the dropdown, some AJAX will automagically go to the specified webform, find its form elements, bring them back, and add them to node submission form for the answer key.

The tricky part here is trying to save them. See, since they weren't known to the content type beforehand, they won't have been defined already with a spot in the database and all that. So, how can I store them? Can I define on the content type a text field with unlimited values and just store one form element's answer per value in the unlimited field?

The tl;dr of this is: Is it possible to save inputs on fieldsets that are different for each node of the same content type?

1 Answer 1


You probably could apply some woodoo to save the data :) But : you would have hard times retreiving it. Node displays only the defined fields, Views only show the fields and so on.

I would suggest not using webform, but simply defining those quizes as new node types and save them, together witha reference to a record about the answer (if it is important).

It might be handy to use eck instead and create an entity type and bundles for each quiz - so you dont have to deal with all the settings on node, just the fields.

  • Displaying the values would be easy if they were saved inside the $node object. Whereas re-creating a webform as a content type would make handling submissions much more difficult, I think. Basically, I don't want to gloss over the "woodoo," I want to know if, and how, it can work. I will check out ECK though, thanks.
    – beth
    Jun 13, 2012 at 18:38
  • they wouldn't go into $node automatically - it only searches for the defined fields, too ...
    – mojzis
    Jun 13, 2012 at 18:40
  • you might try hook_TYPE_load() as mentioned here : api.drupal.org/api/drupal/includes%21entity.inc/function/… but thats quite close to the woodoo :)
    – mojzis
    Jun 13, 2012 at 18:44
  • i dont understand this part : "re-creating a webform as a content type" Does it mean you allready have them done ?
    – mojzis
    Jun 13, 2012 at 18:46
  • You suggested that using node types instead of webforms would be easier. I'm dubious. Yes, the webforms are already set up.
    – beth
    Jun 13, 2012 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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