We help IT Professionals succeed at work.

Element INCIDENT is undefined in FORM

Dolamite Jenkins
Dolamite Jenkins asked
on
Im trying to send $_POST data from my App to my CF site... after some reading I'm under the impression that form. is the equivalent of $_POST .... i keep getting the above error ... but when I hard code the data  on the datatransfer.cfm page it works ... leading me to believe my site is block the apps access (session.allow= true) or this is the wrong way to send data to coldfusion ... any guidance would be appreciated ... thanks

the app sending

payload = {'Incident' :Incident,'Ic_number':Ic_number,'Last_Name':Last_Name, 'First_Name':First_Name}
headers = {'content-type': 'application/x-www-form-urlencoded'}
r = requests.post("http://xxxx.com/datatransfer.cfm", data=payload)

Open in new window


Coldfusion form xxxxx.datatransfer.cfm

<cfset  session.allowin = "true">
<cfset incident_number = #form.Incident#>
<cfset active_incident_number = #form.Ic_number#>
<cfset lastname = #form.Last_Name#>
<cfset firstname = #form.First_Name#>

Open in new window


Application Page

<!--- Create the application --->
   <cfapplication name="xxxxxx"
   	clientmanagement="Yes"
       sessionmanagement="Yes"
       sessiontimeout="#CreateTimeSpan(0,0,15,0)#"
       applicationtimeout="#CreateTimeSpan(0,2,0,0)#" />
   
   <!--- Now define that this user is logged out by default --->
   <CFPARAM NAME="session.allowin" DEFAULT="false" />
   
   <!--- Now define this user id to zero by default, this will be used later on to access specific information about this user. --->
   <CFPARAM NAME="session.user_id" DEFAULT="0" />
   
   <!--- Now if the variable "session.allowin" does not equal true, send user to the login page --->
   <!--- the other thing you must check for is if the page calling this application.cfm is the "login.cfm" page and the "Login_process.cfm" page since the Application.cfm is always called, if this is not checked the application will simply Loop over and over. To check that, you do the following call --->
   
   <cfif session.allowin neq "true">
   	<cfif  ListLast(CGI.SCRIPT_NAME, "/") EQ "login.cfm">
       <cfelseif ListLast(CGI.SCRIPT_NAME, "/") EQ "login_process.cfm">
       <cfelse>
       	<!--- this user is not logged in, alert user and redirect to the login.cfm page --->
           <script>
           	alert("You must login to access this area!");
               self.location="login.cfm";
           </script>
       </cfif>
   </cfif>
   

Open in new window

Comment
Watch Question

Check your form to be sure that you have an input tag called "Incident"   and that the input tag is text or select.  If the tag is a checkbox, then the variable will only exist if the checkbox is checked.    Assuming it is not a checkbox, then perhaps you missed defining the "name" attribute or you have a type-o in the name or the tag is outside the form tag.

Author

Commented:
this is coming from a python app to coldfusion

Author

Commented:
thanks
Why the "B" grade?   You didn't ask any follow-up questions and seemed to have no problem answering it.  If you don't have any questions that are unanswered, then the grade should be an A