Dynamic Items in Form Select Field

Hey,

I am currently facing the the following problem:

  • I have 2 collections (collection a, collection b). Collection B consists of a name and a mail address.
  • Collection A has a direct reference to collection B.
  • On the collection A page template I want to include an option to select one of the collection B items (don’t mind if it is via selector, radio box, …).
  • The form data should include the selected data (name, mail address) from collection B.

As far as I understand that is not possible with the standard options, right?

Any idea if and how this might work using JS?

Thanks a lot in advance!

Michael

Hey @michael
This might be done in html code, can you please share a preview link?

1 Like

Hi Anna,

that’s the preview link.

https://preview.webflow.com/preview/dynamicform?preview=86de3a36eb836bf4a6a21c27a973a319

You have any idea how this might be done?

Cheers,
Michael

1 Like

Hi Michael,

Yes it can be done with the radio buttons

  1. Add a dynamic List under Select expert and link it to the contacts collection.

  2. Delete all but one of the radio button fields you’ve already made. Drag and drop the one remaining into the dynamic list above.

  3. Link the Field label to the contact name. (get text from contacts and choose name)

  4. Add an Html embed right below the radio button field (inside the dynamic item) and add the following code, replacing the NAME & EMAIL with dynamic fields:

  <script type="text/javascript" language="JavaScript">
    <!--
    document.write('<input ');
    document.write('   type="hidden" ');
    document.write('   name="Expert" ');
    document.write('   value="NAME">');
    //-->
    <!--
    document.write('<input ');
    document.write('   type="hidden" ');
    document.write('   name="Expert-email" ');
    document.write('   value="EMAIL">');
    //-->
    </script>

Like this:

Now publish the page, try sending a form and tell me if it works :slight_smile:

Good Luck,
Anna

2 Likes

That’s amazing!

Thanks a lot :D!

1 Like

anytime @michael

best of luck

Hey @Anna_Kelian,

I just ran into some problems with dynamic items in form fields again.

Do you have any ideas how to solve it ;)?

Thanks,
Michael

Original question already solved. Create a new post if you need more help.