Form Collection Sequence

Results 1 to 3 of 3

Thread: Form Collection Sequence

  1. #1
    Lon Guest

    Default Form Collection Sequence

    I asked this a couple days ago, but since this board rotates so fast I though another shot was in order...<BR><BR>OK, I&#039m stumped. Anyone know how the order that form fields are stored in the form collection. It is not neccesarily the order that they appear in the HTML or the tab order, although it can be. For any given form the order is always the same but I can&#039t crack how that order is determined.<BR><BR>I am using the "For Each Item in ... Next" structure to get the fields.<BR><BR>Thanks

  2. #2 Guest

    Default RE: Form Collection Sequence

    Each document has a forms collection which can contain multiple forms ... each Form is a collection of buttons, checkboxes, text fields, etc. ... and select objects are actually a collection of options. It can be rather complicated, but I would assume things would read out in a linear fashion, but because of the complexity of it ... I&#039m not sure of how IIS will populate the Response.Form collection.

  3. #3
    Mike Shaffer Guest

    Default RE: Form Collection Sequence

    Hi Lon,<BR><BR>This code *should* provide the fields in the same order that they are listed in the original HTML form (use the POST method). It also cleans up urlencoding. Hope this helps!<BR><BR>----------------------<BR> Function strGetFormNames()<BR> dim strFormNames()<BR> dim strFormFields<BR> dim intCounter<BR> dim strField<BR> dim intFieldIndex<BR> dim blnFieldFound<BR> dim strCurrentField<BR> <BR> strFormFields=split(request.form, "&")<BR> intCounter=0<BR> for each strField in strFormFields<BR> blnFieldFound = false<BR> strCurrentField=left(strField, instr(strField, "=")-1)<BR> strCurrentField=trim(strCurrentField)<BR> strCurrentField=replace(strCurrentField, "+", " ")<BR> if instr(strCurrentField, "%") &#062; 0 then<BR> for bytCharVal=0 to 15<BR> strCurrentField=replace(strCurrentField, "%0" & hex(bytCharVal), chr(bytCharVal))<BR> next<BR> for bytCharVal=16 to 255<BR> strCurrentField=replace(strCurrentField, "%" & hex(bytCharVal), chr(bytCharVal))<BR> next<BR> end if<BR> if intCounter&#062;0 then<BR> for intFieldIndex = 0 to intCounter - 1<BR> if lcase(strCurrentField)=lcase(strFormNames(intField Index)) then<BR> blnFieldFound = true<BR> exit for<BR> end if<BR> next<BR> end if<BR> if not blnFieldFound and strCurrentField &#062; "" then <BR> redim preserve strFormNames(intCounter)<BR> strFormNames(intCounter) = strCurrentField<BR> intCounter=intCounter+1<BR> end if<BR> next<BR> strGetFormNames=strFormNames<BR> end function<BR> &#039<BR> dim strFormFields<BR> dim strField<BR><BR> &#039 Now we parse the input and append it to the message<BR> &#039<BR> strFormFields=split(request.form, "&")<BR> intCounter=0<BR> for each strField in strFormFields<BR> response.write strfield & "<BR>"<BR> next<BR> &#039<BR>----------------------<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts