0

So I have webform module installed and I created a webform. Webform has an choice field (drop-down). Let's say you can select one of 3 options: "one", "two", "three". I need a way to add (editable) array of numbers to each of this option. I.e.

one: 75, 50, 80

two: 25, 50, 65

three: 20, 40, 70

So, as far as I know those options are not entities and I can not add fields to them to store those numbers.

My idea is to create new content type to hold those numbers, but I need a way to connect field options with my new content type. Meaning, when creating new node in that new content type, beside entering numbers 75, 50, 80 I need a reference field with options "one", "two" and "three" so I could know to what webform field numbers in this node belong.

Other way would be to reference other way - to add node reference to field option, but I think that's not possible either.

Any idea how to solve this?

  • I'd rather use the "Entity select" input field (or similiar) for this - allows direct selection of a referenced entities, optionally filtered by custom view. – Hudri Aug 19 at 11:35
  • Ok, but where should I put that entity select field? Field option is not entity so I can't add that field inside my content type. And I can't add reference to new content type inside option since it's not entity again. – MilanG Aug 19 at 11:53
  • Just for clarification: Your users shall submit webforms, and when they do so they also shall select some options based on previously created content nodes? – Hudri Aug 19 at 12:01
  • No, they will see only drop-down with those 3 values: "one", "two", "three" and can select one of them. And then in my custom submission handler I'll check what user selected and if he selected i.e. "one" I want to read values 75,50,80...and if he selected "two" I want to read 25,50,65... for my internal processing. User will not be aware of those numbers at all. – MilanG Aug 19 at 12:04
  • So basically with every field option I need some extra (editable) data, some array of numbers, visible only from form submission handler. – MilanG Aug 19 at 12:10

Your Answer

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

Browse other questions tagged or ask your own question.