Different email response based on...

User 2942998 Photo


Registered User
74 posts

Heeeey Buuuuuudy....(you know it's bad when it starts like this)

I have the formatting done and I am building the form and adding code to the script and then a thought popped into my head.

This echo's a link to download the pdf. The form requires a validated email address, is it possible to echo to emailAddress and have the download link populate into the response email?

Just wondering if this is something that is doable without a ton of effort.
User 187934 Photo


Senior Advisor
20,226 posts

Do you care if people share the link?
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
User 2942998 Photo


Registered User
74 posts

Not so much, after all they can copy and share the link as well when it's echoed on the outline.php (formally named presentation page you set in the script) but if the link could be obfuscated, that would be handy.

My primary intent for the form is:
1. Loosely track what and where the outlines are going (I have an issue with a different training company stealing my outlines...long story)
2. Track where the training interest/demand is

As I was testing there isn't a way to fully verify an email i.e. confirm its real so a user could put in Keith@nospam.com and still access the outline, of course I get the IP and bogus email information and could block them.

User 187934 Photo


Senior Advisor
20,226 posts

Let me look into it. I know I've hacked a few forms to do some custom texting but I know that email setup causes issues.
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
User 187934 Photo


Senior Advisor
20,226 posts

Here's a proof of concept.
https://ericrohloff.com/coffeecup/ccfor … response2/
Let me know.
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
User 2942998 Photo


Registered User
74 posts

I sent a couple through and it seems to work perfectly. I think this would do the trick since you don't get the outline without a valid email.
User 187934 Photo


Senior Advisor
20,226 posts

This is all you need. Adjust the href links to your actual presentation locations. Add two inputs to your form and name them presentation1 and presentation2. It doesn't matter where you put them as they will be hidden. Your select needs to be named presentations
Add a HTML element to your page and paste the code below into it. I removed the [_form_results_] reference from the confirmation page to prevent confusion, as the links aren't clickable there.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>// ver 1
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ('input[name^="presentation"]').prop('readonly','true');
jQ('input[name^="presentation"]').parent().parent('[id^="item"]').css('display','none');
jQ('select[name="presentations"]').on('change', function() {
var choice = jQ(this).val();
if(choice == 'Fiber Characteristics'){
jQ('input[name="presentation1"]').val('<a href="https://www.coffeecup.com/forums/web-form-builder/different-email-response-based-on-form-field-selection/?post_id=291124#post291124">Fiber Characteristics</a>');
}else if(choice == 'OTDR use and testing'){
jQ('input[name="presentation2"]').val('<a href="https://www.coffeecup.com/forums/web-form-builder/different-email-response-based-on-form-field-selection/?post_id=294110#post294110">OTDR use and testing</a>');
}else if(choice == 'Both Presentations'){
jQ('input[name="presentation1"]').val('<a href="https://www.coffeecup.com/forums/web-form-builder/different-email-response-based-on-form-field-selection/?post_id=291124#post291124">Fiber Characteristics</a>');
jQ('input[name="presentation2"]').val('<a href="https://www.coffeecup.com/forums/web-form-builder/different-email-response-based-on-form-field-selection/?post_id=294110#post294110">OTDR use and testing</a>');
}
});
});</script>
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
User 2942998 Photo


Registered User
74 posts

Aaaaand...I got lost doing translations from the old form to the new.

Here is the real form (presentation was a starting point) https://vantekconsulting.net/course_outline.html
The dropdown is "outline" and there are 39 options (multiple selection i.e. Presentation 1 & 2 is not necessary).
Note: the form is running on the php at the moment

This is what I did;
1. On the form page I added an html element above the form and added the modified script bellow
2. Changed FB from redirect to confirmation message
3. Added a text field to the form and named it outline1 (not clear if I was supposed to hide this in FB or the script did this, but it appeared on the form in the browser)
4. Added the href link

I'm also going to assume that one of my mistakes is I have to add a text field for each option? e.g. outline1, outline2, ....outline39 and add these fields to the form?

Sorry to be daft...

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>// ver 1
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ('input[name^="outline"]').prop('readonly','true');
jQ('input[name^="outline"]').parent().parent('[id^="item"]').css('display','none');
jQ('select[name="outline"]').on('change', function() {
var choice = jQ(this).val();
if(choice == 'ETA OSP Certification'){
jQ('input[name="outline1"]').val('<a href="https://vantekconsulting.net/files/course_outlines/VTC%20-%20ETA%20OSP%20Cert.pdf">ETA OSP Certification</a>');
}else if(choice == 'ETA FOI Certification'){
jQ('input[name="outline1"]').val('<a href="https://vantekconsulting.net/files/course_outlines/VTC%20-%20ETA%20FOI%20Cert.pdf">ETA FOI Certification</a>');
}else if(choice == 'Level 1 Fiber - Essential Fiber Optics & Testing'){
jQ('input[name="outline1"]').val('<a href="https://vantekconsulting.net/files/course_outlines/VTC%20-%20ETA%20OSP%20Cert.pdf">Level 1 Fiber - Essential Fiber Optics & Testing</a>');
}
console.log(choice);
});
});</script>

User 187934 Photo


Senior Advisor
20,226 posts

How about putting each sub category in a different drop down? So you would have all the main categories in one select. You could use conditionals to show the outlines for that category. The way you have it now they can choose one of those non course options +++++Fiber Courses+++++ and not get a link.
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
User 2942998 Photo


Registered User
74 posts

That's a good point and idea, thank you.

The course outline is (at this moment) a required field, so if I did 3 drop downs I would have to make them not required.

What would happen if someone selected an option from each sub category, would they get 3 links in the email? or...since the script is an "else if" would it stop at the first selection/match, for instance a course is selected in Fiber, Copper and Networking, it would only provide the link for the selected fiber outline? (which is fine, I can add verbiage to only select one category and one outline. Or is there a way to link the sub categories so only one selection can be made?

I was just looking at Form Designer and considering that as the frontend, in FD you can disable the option so that's another direction and may be the easy solution. I would assume that since FD is hooked into WFB script that all of the custom scripts would work the same.


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.