Results 1 to 3 of 3

Thread: ASP Form

  1. #1

    Thread Starter
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    ASP Form

    This has sat in the ASP forum for a couple of days but I haven't had any response... can someone help..


    I'm reasonably new to ASP so forgive me if this is all old hat.
    I have a FORM on a HTML page, method=POST.
    I also have an ASP page that's entire purpose is to e-mail the contents of the form to a nominated person. To save on typing my ASP page contains this code to build the body of the e-mail

    Code:
    for each fItem in Request.Form
    tmpbody=tmpbody+fitem+" : "
    tmpbody=tmpbody+Request.Form(fItem)
    tmpbody=tmpbody+vbcrlf
    next

    It then sends it using the CDONTS.NewMail object.

    This all works fine except for the fact that the form entries appear to be in a random order in the e-mail - is there a way I can control the order of the form elements without having to do a separate Request.Form("this item") for each form element?
    I've tried the TabIndex property of each <INPUT item on the form but it doesn't seem to make a difference..

    or am I going about the whole thing the wrong way..?
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  2. #2
    Hyperactive Member FATBOYPEE's Avatar
    Join Date
    May 2001
    Location
    Charleville (Ireland) Still. ANYONE GOT A JOB I CAN HAVE ? GIZA JOB. I CAN DO THAT....
    Posts
    463
    In my limited experience you cannot order the forms contents or output them in a different order unless you use an array or the the "This Item" method. I don't suppose it's logical to restructure your form object in the way you want your Email represented ?

    There may be other ways of doing wot you're doing, I use the
    4guysfromRolla
    Website for ASP if I dont get a response here (Of course, I always post it here first, loyalty etc etc..)

    FBP

    Best Bar.....

  3. #3
    Fanatic Member
    Join Date
    Jul 2001
    Location
    London UK
    Posts
    671
    I don't know whether this helps but I normally use something like the following:

    VB Code:
    1. Dim tmpbody,i
    2. If Request.Form.Count <> 0 then
    3. for i = 1 to Request.Form.Count
    4. If UCASE(Trim(Request.Form.Key(i))) <> "IGNORE" Then
    5. tmpbody=tmpbody & Request.Form(i).Item & Request.Form.Key(i) & chr(13)
    6. End If
    7. Next
    8. Else
    9. tmpbody="No Form Found."
    10. End If

    Where the Submit / Reset buttons or any other irrelevant controls are given the name "ignore".

    and all other controls are given the name of the form field (eg the question if it is a survey)

    This seems to send the controls in a consistent Top/Down Order - at least in IE (am not sure about netscape).

Posting Permissions

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



Click Here to Expand Forum to Full Width