Forums

Show or Hide custom or container based on Dropdown Selection

larry_g1s 14 Jun, 2018
I'm trying to get the content of a custom element to show or be hidden based upon a selection from a dropdown element. Since the custom doesn't have any 'hidden' attributes with it, I put it in a container. I've set the container to be hidden with the choices in the dropdown the element tab, or radio button in the example attached, to show or hide the custom element in the container based upon the choices. Regardless of what I do the custom element always shows. What am I doing wrong?

GreyHead 14 Jun, 2018
Hi larry_g1s,

And if you remove the container, add the ID directly to your HTML (and maybe also enable the 'Pure code' option) - does that work?

Bob
larry_g1s 14 Jun, 2018
No, I'm sorry. (see below)

I thought having it in the container would help since the container can be set to hidden and the custom element cannot.

GreyHead 16 Jun, 2018
Hi larry_g1s,

I don't see any ID in your HTML
<p id='starscream'>.  .  . </p> 
Bob
larry_g1s 16 Jun, 2018
That looked like it solved it! Thanks. I thought I had to name the element starscream. Thanks so much for your time.
larry_g1s 21 Jun, 2018
Sorry, one more thing as it relates to this. I'm now trying to get the verbiage that's in the custom element to show up in body of the email sent. I know how to do this currently, but it's using the elements ID. Since the custom doesn't have an idea with the element, it's not showing up, even if I use the ID in the HTML (i.e. starscream). Any idea on how to achieve this?
GreyHead 21 Jun, 2018
Hi larry_g1s,

As it isn't form data you'll need to recreate it in the email body. You can use a couple of lines to PHP to check if the radio button is set and display teh HTML or not.

Bob
larry_g1s 21 Jun, 2018
hmmm... I'm doing currently is taking the answer from the radio button/dropdown and adding that in to the email subject. The problem I'm running in to now, is that I want the form to go to one of the three email recipient based upon one of the three options in the dropdown, and based upon the other two options to go to another email recipient. Looking around this forum, I believe I know how to do this. But because the email is in one of the dropdown selections (i.e. em1=Choose this option) when I use the ID of that dropdown element, the email is what shows in the forms email to the recipient. So what I thought I could do is duplicate the dropdown chose in custom element, hints the reason for this thread, and have that custom element duplicate go in to the html email to the recipient. Whew...
Do you have a better way to achieve this?
GreyHead 22 Jun, 2018
Hi larry_g1s,

Sorry, I think that got lost in translation . . .

Bob
larry_g1s 26 Jun, 2018
I apologize. Let me see if I can sum it up better.

In short:
What I have now is a dropdown menu with three options. The email is being sent to three people. The selected option in that dropdown element is included in the email via the elements ID.

What I want to do:
I want to send the email form to the three different people, but based upon the users selection of the dropdown. i.e. If choice 1 is selected, the email form would go to person A, if choice 2 or 3 from the dropdown are selected, the email would go to persons B & C. The dropdown selection would still be included in the email sent so the person receiving the email form would know how to reply back appropriately.

My problem:
I've seen on these forms how to send the email to different recipients via a user selection of a dropdown. The problem I'm having is that the dropdown selections have the options with the email as part of the option (i.e. em1=This address) as show here for CFV5 version: https://www.chronoengine.com/faqs/52-chronoforms/cfv4/cfv4-emails/2603-how-can-i-send-an-email-to-different-addresses

Since the email that is sent with that elements ID takes the first part of that option (i.e. em1), em1 or the email is what is shown in the email form sent to the email recipient, not the actual choice shown to the user. So the email recipient gets the em1, not the users choice and doesn't know how to correctly respond back to the user.

My thought was to have a custom element show that mirrored the selected choice of the user (hints the reason for this thread). Then I could have it still email to the correct user, but the custom element that was the same as the dropdown choice would be shown in the email. But I cannot get the custom element to show in the email form sent.

Does this make sense now?
GreyHead 27 Jun, 2018
Hi larry_g1s,

Yes I think that makes sense to me but I'm not sure what the problem is - once you have an {emaiL_to_use} value set you can use that in your email body or in the Reply To Email setting.

Bob
larry_g1s 27 Jun, 2018
If I understand you correctly, I don't want to use the {email_to_use} value in the email body, I want what the user sees. Please see below.

larry_g1s 03 Jul, 2018
Thank you. I'll read through.
This topic is locked and no more replies can be posted.