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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using FORM collection in CF, not finding fields! 1

Status
Not open for further replies.

djeddiej

Instructor
May 26, 2000
32
CA
Hello -

I have created a standard compliant form with over 40 fields that I am processing through CF's FORM collection. I have validated my HTML, but when I try to read the fieldnames from the form for processing using FORM.fieldnames, I am always getting the first two fields missing! What should I be looking for when troubleshooting this kind of issue?

here is some example code to understand...

<cfif isDefined(&quot;FORM.whichform&quot;) AND FORM.whichform EQ &quot;blahblah&quot;>
<cfoutput>#FORM.fieldnames#</cfoutput>
<!--- print for now, I will replace with an actual query once I get all the fields!!!!! --->
</cfif>

<form name=&quot;blahblah&quot; id=&quot;blahblah&quot; action=&quot;<cfoutput>thispage.cfm</cfoutput>&quot;>
<input type=&quot;text&quot; name=&quot;f1&quot; id=&quot;f1&quot; value=&quot;aaa&quot; />
<input type=&quot;text&quot; name=&quot;f2&quot; id=&quot;f2&quot; value=&quot;bbb&quot; />
<input type=&quot;text&quot; name=&quot;f3&quot; id=&quot;f3&quot; value=&quot;bbb&quot; />
...
<input type=&quot;text&quot; name=&quot;f40&quot; id=&quot;f40&quot; value=&quot;ccc&quot; />
<input type=&quot;hidden&quot; name=&quot;whichform&quot; name=&quot;whichform&quot; value=&quot;blahblah&quot; />
<input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;blahblah&quot; />
</form>

This gives me as OUTPUT (after submitting, of course)

F3,F4,F5,...F40,WHICHFORM,SUBMIT

what the heck happened to the first few fields? Am I going mad?

Any assistance is appreciated.

DJ Eddie J
 
I notice that you don't have METHOD=&quot;POST&quot; in your form tag. I'm guessing that was just a typo in your message... since FORM.whichform would always fail and you'd never get anything from FORM.fieldnames if you weren't using POST.

I replicated your form on my box, and FORM.fieldnames returns all field names here. Perhaps there's something amiss in your code or your server configuration. I doubt you're running up against any sort of limit of the HTTP_POST headers... since I've definitely had forms with more than 40 fields.

One thing, though... I have found that FORM.fieldnames is pretty unreliable. I think I even openned a support ticket with Macromedia once about it (I was getting duplicate names in the list... not really similar to your circumstance, but...) and was told that it's not recommended that you rely on FORM.fieldnames. In my case, I was trying to do:
Code:
   <CFLOOP list=&quot;#FORM.fieldnames#&quot; index=&quot;whichField&quot;>
          :
I guess the &quot;recommended&quot; method of doing the above is actually:
Code:
   <CFLOOP collection=&quot;#FORM#&quot; item=&quot;whichField&quot;>
          :

Don't know if you can use that or not.


-Carl
 
Hi Carl -

Sorry for the late response, but thank you for your assistance. I figured it out, it was incorrect ID and tag attributes (arrggh)

thanks again.


Edward J. Apostol
Web Application Development Programmer
Toronto, ON Canada
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top