Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No communication between a form and cfm ( Really simple :)

Status
Not open for further replies.

3allawy

Programmer
Oct 19, 2005
28
CA
Hi, I am always getting an error message when clicking on the Go button. I have 2 files. One file contains a form and the other a simple cfm file. PLEASE ADVISE


Error Occurred While Processing Request
String index out of range: 0

The error occurred in D:\projects\new-jmsb\form\responsetiks.cfm: line 8

6 : </cfif>
7 :
8 : <cfif isdefined(FORM.Conc)>
9 : <cflocation url=" addtoken="no">
10 : </cfif>



---------------Form Page ========================
form id="quicksearch" name="quicksearch" action="response.cfm" method="post">

<label for="quicksearchBox">Search:</label> <input class="styledinput" tabindex="1" accesskey="S" type="text" name="q" id="quicksearchBox" size="9" /><input class="styledinput" tabindex="2" type="submit" value="Go" id="quicksearchButton" /><br /><br />

<p><input type="radio" accesskey="J" name="Jmsb" value="J"/> School of Business</p>

<p><input type="radio" accesskey="C" name="Conc" value="C" /> Condolle University</p> </form>

------------------------response.cfm--------

<cfparam name="FORM.Jmsb" default="">
<cfparam name="FORM.Conc" default="">

<cfif isdefined(FORM.Jmsb)>
<cflocation url=" addtoken="no">
</cfif>

<cfif isdefined(FORM.Conc)>
<cflocation url=" addtoken="no">
</cfif>
 
Your form variables inside your cfif statements should be in quotes.
Code:
<cfif isdefined(FORM.Jmsb)>
<cfif isdefined(FORM.Conc)>

Should be

<cfif isdefined("FORM.Jmsb")>
<cfif isdefined("FORM.Conc")>
Plus, you probably need to get rid of the cfparam tags. If you have them, that makes sure that both form variables are always defined, which makse your IsDefined statements useless. The cfparam tag will always create the variable, it will just be empty and not have a value (unless it really was filled out on the form).

If you want to use the cfparams, just replace your IsDefineds with Len(Trim()).
Code:
<cfif Len(Trim(FORM.Jmsb))>


Hope This Helps!

ECAR
ECAR Technologies, LLC

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top