Auto populate another field based on...

User 2745224 Photo


Registered User
4 posts

I have a very convoluted form that I am making. This form is a request for business card print production. That being said, we have a specific business card template that we use for our business and we have two distinct address blocks...one in Florida and the other in Virginia.

The second part of this form (underneath the WFB form in HTML), I have a "dynamic table" that has background images of the business card all cut up into slices, but you can't tell as there is no spacing between cells, so it looks like a blank business card. Within some of these slices is text based on whatever the user has selected from the WFB form. So far it works wonderfully based on some javascript.

For instance within the WFB form there is a drop down form field for "Office Address". The code looks something like this…

<div class="fb-dropdown">
<select id="item21_select_1" data-hint="" name="WhatAddress" required>
<option selected id="item21_0_option" value="">
Choose one
</option>
<option id="item21_1_option" value="Bonita Springs, FL">
Bonita Springs, FL
</option>
<option id="item21_2_option" value="Richmond, VA">
Richmond, VA
</option>
</select>
</div>

When a person wants to generate a preview of what their card will look like (by using a button outside of the WFB form), they hit the button and like magic...a card that looks pretty similar to an actual printed version is produced on screen.

Using this type of code based on the button for the addresses produces horrible results...

document.getElementById("Address").innerHTML = document.getElementById("item21_1_option").value;
document.getElementById("Address").innerHTML = document.getElementById("item21_2_option").value;

If you notice the "Address" Id is on the simulated card, whereas the "item21_1_option" and the "item21_2_option" are within the above WFB form.

So basically, how can I make the address block change addresses on the screen image of the business card based on a dropdown selection within the WFB form?
User 187934 Photo


Senior Advisor
20,271 posts

I through this together. Seems to work the way your wanting. If I can see your page before I do any more that would be a great help.:)
http://ericrohloff.com/coffeecup/ccforum/formbuilder/coffeecup-forms/dropdown-to-other-elements/index.html
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.