Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Element undefined in FORM

Guest
Jun 08, 2006 Jun 08, 2006
We are using CFMX 7.1 and have had a random problem show up where Element 'X' is undefined in FORM. It has happened to multiple people on multiple forms, with seemingly no reason for it. I have had a user encounter the error, click their back button and "view source" and verify that the form element was in fact defined. I have had it say hidden form elements are not defined, select form elements and text form elements - on both <form and <cfform. One time it works, another time it doesn't- refresh and it works all of a sudden. I know for a fact that the form element is defined- but CF is somehow randomly not seeing it.

Anyone else encounter this? I saw a couple posts from a year ago, but no responses.

Thanks-
David
3.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
What is the type of the form element(s). Unchecked checkboxes and radio buttons do not have their names passed to the action page.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
Yes- I'd expect that if these were radio or check boxes, but the ones that I have seen it happen with are <input type="text"..., <select.., and <input type="hidden"....

The strange thing is that the user can verify that the element is defined through viewing the source when clicking the back button. Things like the <input type=Hidden in this case are populated by query and if no value, they wouldn't even get to the submission form. These are errors happening to a user logged in to the Web application- submitting succesfully, then all of a sudden the error, so they refresh the page and it works.

I dumped the error once into an email and found that many form elements were not defined according to coldfusion- It is like the post got corrupted.

david
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2006 Jun 08, 2006
Check to make sure that the form variables have names. Without names, the values will not be placed in the forms scope.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 08, 2006 Jun 08, 2006
This is a well known (to me at least) issue. It has never been solved. It first showed up many years ago as you've discovered and no-one has ever voiced a cause or solution. We first saw it under CF 4.5 and it continues to this day with CFMX7. I suspect it may simply be a random Browser/Network issue. Perhaps a corrupt byte chops up the Form list. GET vs. POST doesn't seem to matter either. We're an Intranet and use only IE.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
Thanks for the sympathy-JMGibson3. Misery loves company, right? I'll keep plugging away at it, maybe something will turn up.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2006 Jun 08, 2006
quote:

Originally posted by: JMGibson3
This is a well known (to me at least) issue. It has never been solved. It first showed up many years ago as you've discovered and no-one has ever voiced a cause or solution. We first saw it under CF 4.5 and it continues to this day with CFMX7. I suspect it may simply be a random Browser/Network issue. Perhaps a corrupt byte chops up the Form list. GET vs. POST doesn't seem to matter either. We're an Intranet and use only IE.

A few weeks ago it happened to me, ie, I was the user. What happened was that I submitted the form and after the code executed and the page loaded, a 2nd http request was sent from the browser. The 2nd request had no form scope at all. This may or may not be what is happening here. You'll have to check yoru webserver logs to see.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
This is an interesting possiblity. did you happen to hit the submit button again, before the submission went thru? In looking at the logs, i don't see anything in the web logs for that particular instance. But, I'll keep looking and comparing logs- both error and web time stamps.

thanks for the suggestion.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
These all have names. I'd expect it to be a consistent error if it were a tag problem or a structural problem. This is seemingly random.

The last error that happened, I dumped the error and captured it in our DB. The interesting thing is that the form dump structure is empty. This is code that hasn't changed in several years. In this case the error is "Element REQLIST is undefined in FORM" . reqlist is a hidden form element. Here is the form code:

<cfset rlist="Host;PlantName;">
<cfset showList="Commodity; Plant name;">
<cfset myForm = "Form1">
<cfset reqRadios="">
<cfset reqCheckBoxes="">
<cfinclude template="checkInput.cfm">
<CFFORM NAME="Form1"
ENCTYPE="multipart/form-data"
ACTION="#homepath#/cgi-bin/SubmitPDDdata.cfm"
METHOD=POST
onsubmit="return validateForm('#rlist#','#showList#');" >

<!--- create local variables for reference by other form elements --->
<cfset currentForm=#url.sampleform#>

<cfquery name="getdiscipline" datasource="#primarydatasource#">
SELECT discipline FROM forms
WHERE Form = '#currentForm#'
</cfquery>
<cfset discipline=#getdiscipline.discipline#>
<!--- create hidden input fields to indicate how submit script should handle sample (what diag responsibiity, table, etc) --->
<cfoutput>
<input type="hidden" name="currentForm" value="#currentForm#">
<input type="hidden" name="discipline" value="#discipline#">
<input type="hidden" name="reqlist" value="#rlist#">
</cfoutput>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2006 Jun 08, 2006
There was no submit button to hit. The form and action code were on different pages.

I saw it happen by watching the browser status bar. Our administrator is across the aisle so I was able to see the IIS logs (it helps that this was on a development server where there are at most 10 people working at any one time). In fact, I was able to repeat the phenomenom indefintely until I changed the code and got on with the task at hand.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
What was it in your code that cause the repeated post? -you said you changed the code- was that because you figured out the cause in the code, or did you modify it to catch the second post and handle it?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2006 Jun 08, 2006
LATEST
quote:

Originally posted by: dbarber
What was it in your code that cause the repeated post? -you said you changed the code- was that because you figured out the cause in the code, or did you modify it to catch the second post and handle it?

I have no idea what caused it. All I know is that as long as I didn't change the code I would get a 2nd http request. I do remember that there was a cfabort in there. However, the task at hand was to finish that template, not to launch into an investigation as to what was causing the 2nd request.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 08, 2006 Jun 08, 2006
The refreshed page could be cached. Also, are you using IsDefined in your action page?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2006 Jun 08, 2006
Using isdefined(...) would definitely catch this, I am not using it on this particular form- but could. Probably should always use isDefined(), but didn't because this form element is a hidden form element with a hard-coded value. I'm not sure how it would ever not be defined. Nor can you directly access the page, because you have to have a valid session to run anything on the page.
Thanks for the continued suggestions and thoughts.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources