0
Explorer
,
/t5/coldfusion-discussions/need-help-with-processing-script/td-p/881173
Jul 02, 2008
Jul 02, 2008
Copy link to clipboard
Copied
Well I'm back again for the 2nd time today. I'd like to thank
everyone who helped me out with my last issue. But now I have
another issue that I'm trying to work out. Craig & Dan here
helped me with sending out 2 separate email responders based off of
questions asked in the cfform.
You can view the form at this link:
http://mswebsol.com/gaslockguarantee/creditapplication.cfm
The problem I'm having right now is that I'm not getting the results I'm looking for. Basically lets say you choose yes for 4 questions but on the 5th question you choose no. Well as it stands right now the script will send out the email response that says your accepted. But what I'm trying to do is if you choose no for any one of the questions you will automatically get an email response that says you're not accepted.
If I choose no for the first question I will get the correct email response which is "your not accepted" so it works for the first question. But if you choose yes for the first question and no for the 2nd or any other question you will get the wrong response that says "you are accepted."
So here's the code
<cfif StructKeyExists(form,"Q1")>
<cfif form.Q1 is "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q2")>
<cfif form.Q2 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q3")>
<cfif form.Q3 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q4")>
<cfif form.Q4 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q5")>
<cfif form.Q5 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
</cfif>
Any help would greatly be appreciated!
Thank you all
Derek Bess
Newbie @ Coldfusion
You can view the form at this link:
http://mswebsol.com/gaslockguarantee/creditapplication.cfm
The problem I'm having right now is that I'm not getting the results I'm looking for. Basically lets say you choose yes for 4 questions but on the 5th question you choose no. Well as it stands right now the script will send out the email response that says your accepted. But what I'm trying to do is if you choose no for any one of the questions you will automatically get an email response that says you're not accepted.
If I choose no for the first question I will get the correct email response which is "your not accepted" so it works for the first question. But if you choose yes for the first question and no for the 2nd or any other question you will get the wrong response that says "you are accepted."
So here's the code
<cfif StructKeyExists(form,"Q1")>
<cfif form.Q1 is "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q2")>
<cfif form.Q2 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q3")>
<cfif form.Q3 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q4")>
<cfif form.Q4 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
<cfelseif StructKeyExists(form,"Q5")>
<cfif form.Q5 eq "yes">
<cfmail>accepted....</cfmail>
<cfelse>
<cfmail>not accepted...</cfmail>
</cfif>
</cfif>
Any help would greatly be appreciated!
Thank you all
Derek Bess
Newbie @ Coldfusion
TOPICS
Getting started
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Jul 02, 2008
Jul 02, 2008
if i understand you correctly, all your if/else logic boils
down to simple:
1) one of the answers is "No" - send "rejected" email
2) all answers are "Yes" - send "accepted" email
i suggest you cfparam all the answers with default="no" on your action
page, so that you do not have to keep checking for structkeyexists:
<cfparam name="form.q1" default="no">
...
<cfparam name="form.qN" default="no">
after that all you need is:
<cfif form.q1 is 'No' OR form.q2 is 'No' OR ... OR form.qN is 'No'>
.....
1) one of the answers is "No" - send "rejected" email
2) all answers are "Yes" - send "accepted" email
i suggest you cfparam all the answers with default="no" on your action
page, so that you do not have to keep checking for structkeyexists:
<cfparam name="form.q1" default="no">
...
<cfparam name="form.qN" default="no">
after that all you need is:
<cfif form.q1 is 'No' OR form.q2 is 'No' OR ... OR form.qN is 'No'>
.....
LEGEND
,
/t5/coldfusion-discussions/need-help-with-processing-script/m-p/881174#M81135
Jul 02, 2008
Jul 02, 2008
Copy link to clipboard
Copied
if i understand you correctly, all your if/else logic boils
down to simple:
1) one of the answers is "No" - send "rejected" email
2) all answers are "Yes" - send "accepted" email
i suggest you cfparam all the answers with default="no" on your action
page, so that you do not have to keep checking for structkeyexists:
<cfparam name="form.q1" default="no">
...
<cfparam name="form.qN" default="no">
after that all you need is:
<cfif form.q1 is 'No' OR form.q2 is 'No' OR ... OR form.qN is 'No'>
...send 'rejected' email code here...
<cfelse>
...send 'accepted' email code here...
</cfif>
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
1) one of the answers is "No" - send "rejected" email
2) all answers are "Yes" - send "accepted" email
i suggest you cfparam all the answers with default="no" on your action
page, so that you do not have to keep checking for structkeyexists:
<cfparam name="form.q1" default="no">
...
<cfparam name="form.qN" default="no">
after that all you need is:
<cfif form.q1 is 'No' OR form.q2 is 'No' OR ... OR form.qN is 'No'>
...send 'rejected' email code here...
<cfelse>
...send 'accepted' email code here...
</cfif>
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
xstortionist
AUTHOR
Explorer
,
LATEST
/t5/coldfusion-discussions/need-help-with-processing-script/m-p/881176#M81137
Jul 03, 2008
Jul 03, 2008
Copy link to clipboard
Copied
Azadi
Thanks for the help! That's exactly what I was looking for. My script now works 100%!
Thanks for the help. I really appreciate it.
Derek
Thanks for the help! That's exactly what I was looking for. My script now works 100%!
Thanks for the help. I really appreciate it.
Derek
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/need-help-with-processing-script/m-p/881175#M81136
Jul 02, 2008
Jul 02, 2008
Copy link to clipboard
Copied
You said,
"But what I'm trying to do is if you choose no for any one of the questions you will automatically get an email response that says you're not accepted."
If you ignore everything else do you see the potential for simplification?
"But what I'm trying to do is if you choose no for any one of the questions you will automatically get an email response that says you're not accepted."
If you ignore everything else do you see the potential for simplification?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

