Link to home
Start Free TrialLog in
Avatar of JohnLucania
JohnLucania

asked on

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?
Avatar of Plucka
Plucka
Flag of Australia image

JohnLucania,

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

Regards
Plucka
Avatar of JohnLucania
JohnLucania

ASKER

yes, it causes.
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.
<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 --->
What is the value of cgi.request_method when you get this error?
Are you asking 'post' or 'get'?  It is 'post'.
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.
<cfif not isdefined("form.fieldNames")>
and
<cfif isdefined("form.fieldNames")>
retrun the same error.
ASKER CERTIFIED SOLUTION
Avatar of Plucka
Plucka
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial