• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 893
  • Last Modified:

Element FIELDNAMES is undefined in FORM

What I need to do is:

<cfif not isdefined("form.fieldNames")>
...
<cfelse>
...
</cfif>

<cfif not isdefined("form.fieldNames")>  returns 'Element FIELDNAMES is undefined in FORM'

How to do?
0
JohnLucania
Asked:
JohnLucania
  • 4
  • 4
1 Solution
 
PluckaCommented:
JohnLucania,

That should work, you sure that line causes the problem?

Regards
Plucka
0
 
JohnLucaniaAuthor Commented:
yes, it causes.
0
 
PluckaCommented:
Sorry,

That can't be true, can you paste your code, i'd say something after the <cfif is causing the error, not that if line.
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
JohnLucaniaAuthor Commented:
<cfif isdefined("form.fieldNames")>  <!---for Delete ID --->
                  <CFLOOP LIST="#form.fieldNames#" index="myInd">
                  
                        <CFIF LEFT(myind,4) eq "INST">
                              <!--- we have found an installment record ---->
                              <!---
                              <CFSET myInstaID = Right(myInd,len(myInd)-4)>
                              <CFSET myInstaAmount = Evaluate('form.InAmount'&myInstaID)>
                              <CFSET myInstaDate = Evaluate('form.InDate'&myInstaID)>
                              --->

                              <cfscript>
                                myInstaID = Right(myInd, Len(myInd) - 4);
                                // give the variable a reasonable default
                                myInstaAmount = 0;

                                // if it exists in the form scope, reset to the form field value
                                if(StructKeyExists(form, 'InAmount' & myInstaID))
                                  myInstaAmount = form['InAmount' & myInstaID];

                                // give the variable a reasonable default
                                myInstaDate = '';

                                // if it exists in the form scope, reset to the form field value
                                if(StructKeyExists(form, 'InDate' & myInstaID))
                                 myInstaDate = form['InDate' & myInstaID];
                              </cfscript>

                              <!--- update the installment record found --->
                              <CFIF isNumeric(myInstaAmount) AND isDate(myInstaDate) AND isNumeric(myInstaID)>
                                    <!---proceed only if we have a good date and amount --->
                                    <cfquery datasource="#REQUEST.USLAXDSN#" name="UpdateInstallment">
                                          UPDATE PledgeInstallments
                                                SET installDate = '#DateFormat(myInstaDate, 'mm/dd/yyyy')#',
                                                      installAmount = #myInstaAmount#
                                          WHERE  pledgeID = #session.myPledgeID# AND installID = #myInstaID#
                                    </cfquery>
                              </CFIF>
                        </CFIF>
                  </CFLOOP>
<cfelse>  <!---for Delete ID --->
                  <cfparam name="clickID" default="0">
                  
                  <!--- Delete records --->
                     <CFIF LEFT(myind,6) eq "Delete">

                        <!---CFSET myDeleteID = Right(myInd,len(myInd)-4) />--->
                        <cfparam name="callerId" default="0">
                              
                        <!--- delete the installment record checked
                        <CFIF isDefined("form.Delete#myInstaID#")>--->
                              <!---proceed only if we have a good date and amount --->
                              <cfquery datasource="#REQUEST.USLAXDSN#" name="DeleteInstallment">
                                    update PledgeInstallments
                                    set InstallDeleteDate = '#DateFormat(Now(), 'mm/dd/yyyy')#'
                                    WHERE  pledgeID = #session.myPledgeID# AND installID = #url.callerId#
                              </cfquery>
                        <!---</CFIF>--->
                  </CFIF>
                  <!--- Delete records  <cfoutput>#callerId#</cfoutput> --->
</cfif>    <!---  for Delete ID --->
0
 
JeffHowdenCommented:
What is the value of cgi.request_method when you get this error?
0
 
JohnLucaniaAuthor Commented:
Are you asking 'post' or 'get'?  It is 'post'.
0
 
PluckaCommented:
You have changed this code since the error.

Where is the line that supposedly causes this error

<cfif not isdefined("form.fieldNames")>

does not exist in your code.
0
 
JohnLucaniaAuthor Commented:
<cfif not isdefined("form.fieldNames")>
and
<cfif isdefined("form.fieldNames")>
retrun the same error.
0
 
PluckaCommented:
No,

There has to be something your not showing us, paste the full error message perhaps.

<cfif isdefined("form.fieldNames")>  <!---for Delete ID --->
               <CFLOOP LIST="#form.fieldNames#" index="myInd">

Is not the same as

<cfif NOT isdefined("form.fieldNames")>  <!---for Delete ID --->
               <CFLOOP LIST="#form.fieldNames#" index="myInd">

as the second one would error on the <CFLOOP as form.fieldNames is not defined.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now