Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
schaudry #1
Help with cfif statement
Can anyone help me find the correct way to write the following statement?
<cfif form.user2 NEQ 15 or 50 or 51 or 52 or 53 or 55 or 200 or 223 or 240 or
265 or 270>
<cfset form.stores = "NA">
<cfset form.products = "NA">
<cfset form.sales = "NA">
<cflocation url="casual4.cfm">
</cfif>
Depending on what the user chooses on the page before this one, I want it to
check and redirect them to the correct page. Thanks for any help you can
provide.
Salman
schaudry Guest
-
CFIF help
I have an HTML that has a list of names pulled from a Database. In my HTML table my headers are Read, Write, Release, View For each employee that... -
Repeating output with cfif statement
I have a problem when multiple checkboxes are "turned on' when multiple values exist for a field in a database. For example: The following code... -
CFIF Statement problems
I am trying to write a cfif statement, which shows a form only if the statemnt acts true. It is a 3 part statement, the first two parts appear to... -
Login error with CFIF statement
Hi all: I'm having trouble with a login CFIF routine. The following code works fine when the login is TRUE, but when I try to login with invalid... -
Using cfoutput within a cfif statement
I am trying to setup a form validation, what i need to do is look at the Specimen Number entered and compare it against the database to see if it... -
BerkTheTurk #2
Re: Help with cfif statement
You would have to write the statement over and over again. For example
<cfif myform.mynumber NEQ 5 OR myform.mynumber NEQ 10 ..... >
Try that
BeRk
BerkTheTurk Guest
-
Kronin555 #3
Re: Help with cfif statement
You can't chain your tests together like that. You have to break them out:
<cfif form.user2 NEQ 15 or form.user2 NEQ 50 or form.user2 NEQ 51 or
form.user2 NEQ 52 or form.user2 NEQ 53 or form.user2 NEQ 55 or form.user2 NEQ
200 or form.user2 NEQ 223 or form.user2 NEQ 240 or form.user2 NEQ 265 or
form.user2 NEQ 270>
That's the first step. Then, you're probably going to want to change your
"or"s to "and"s. I'm assuming that if the user doesn't equal any of that list,
you want to do what's in the if block.
<cfif form.user2 NEQ 15 and form.user2 NEQ 50 and form.user2 NEQ 51 and
form.user2 NEQ 52 and form.user2 NEQ 53 and form.user2 NEQ 55 and form.user2
NEQ 200 and form.user2 NEQ 223 and form.user2 NEQ 240 and form.user2 NEQ 265
and form.user2 NEQ 270>
The other thing you could do is put them in a list.
<cfif ListFind("15,50,51,52,53,55,200,223,240,265,270",f orm.user2) eq 0>
<!--- form.user2 isn't in that list, so it isn't any of those values --->
</cfif>
Kronin555 Guest
-
schaudry #4
Re: Help with cfif statement
Thank you, that is exactly what I was looking for. Now the second part to this
is, how do i automatically submit the values from the form on the previous page
to casual4.cfm as in the code below:
<cfif ListFind("15,50,51,52,53,55,200,223,240,265,270",f orm.user2) EQ 0>
<cfform action="casual4.cfm" method="post">
<cfset form.FirstName = "#form.FirstName#">
<cfset form.LastName = "#form.LastName#">
<cfset form.Title = "#form.Title#">
<cfset form.Organization = "#form.Organization#">
<cfset form.Address1 = "#form.Address1#">
<cfset form.Address2 = "#Address2#">
<cfset form.City = "#form.City#">
<cfset form.State = "#form.State#">
<cfset form.PostalCode = "#form.PostalCode#">
<cfset form.Country = "#form.Country#">
<cfset form.Phone = "#form.Phone#">
<cfset form.Fax = "#form.Fax#">
<cfset form.Email = "#form.Email#">
<cfset form.user1 = "#form.user1#">
<cfset form.user2 = "#form.user2#">
<cfset form.firsttimer = "#form.firsttimer#">
<cfset form.stores = "NA">
<cfset form.products = "NA">
<cfset form.sales = "NA">
<script>
this.form.submit();
</script>
</cfform>
</cfif>
The code as I have it written now does not send the user to casual4.cfm if
they pick something that is not in the list above. It still sends everyone to
casual3.cfm. Any ideas on how to autosubmit the information to the next page?
Thanks!
schaudry Guest
-
jorgepino #5
Re: Help with cfif statement
if you want to pass the value you have to use
<cfform action="casual4.cfm" method="post">
<input type="hidden" name="Title" value=""#form.Title#">
.....
jorgepino Guest
-
schaudry #6
Re: Help with cfif statement
I tried changing it all to input type=hidden...... but its still taking everyone to the casual3.cfm page. Its ignoring the cfif statement. Any ideas?
schaudry Guest
-
schaudry #7
Re: Help with cfif statement
So, after a lot of searching, I finally find out how to autosubmit it. If
anyone wants to know, here is my code....
<cfif ListFind("15,50,51,52,53,55,200,223,240,265,270",f orm.user2) EQ 0>
<cfform name="skipcasual3" action="casual4.cfm" method="post">
<cfoutput>
<input name="FirstName" type="hidden" value="#FirstName#">
<input name="LastName" type="hidden" value="#LastName#">
<input name="Title" type="hidden" value="#Title#">
<input name="Organization" type="hidden" value="#Organization#">
<input name="Address1" type="hidden" value="#Address1#">
<input name="Address2" type="hidden" value="#Address2#">
<input name="City" type="hidden" value="#City#">
<input name="State" type="hidden" value="#State#">
<input name="PostalCode" type="hidden" value="#PostalCode#">
<input name="Country" type="hidden" value="#Country#">
<input name="Phone" type="hidden" value="#Phone#">
<input name="Fax" type="hidden" value="#Fax#">
<input name="Email" type="hidden" value="#Email#">
<input name="user1" type="hidden" value="#user1#">
<input name="user2" type="hidden" value="#user2#">
<input name="stores" type="hidden" value="NA">
<input name="products" type="hidden" value="NA">
<input name="sales" type="hidden" value="NA">
<input name="firsttimer" type="hidden" value="#firsttimer#">
</cfoutput>
<script>
document.skipcasual3.submit();
</script>
</cfform>
</cfif>
schaudry Guest



Reply With Quote

