Cannot post a Drop Down value...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kip1790
    New Member
    • Jun 2009
    • 13

    Cannot post a Drop Down value...

    Hi, I'm sure there is a simple solution for this but I've been trailing the net for hours trying to find one with no avail. I have an ASP page with a standard html form. On submit the values are loaded into an array and I call an ASP file that emails the values to me. Everything works but it seems to skip the drop down value. Please help....

    Code:
    <form action="deliver.asp" method="post">
    
    <p>First Name: <font color="#FF0000">*</font>
    <input name="fname" size="24" type="text" id="fname" value="<%=inputArray(1,2)%>" <%IF badItem=1 THEN response.write "class=""errorItem"""%>/>
    </p>
    
    <p>Last Name: <font color="#FF0000">*</font>
    <input name="lname" size="24" type="text" id="lname" value="<%=inputArray(2,2)%>" <%IF badItem=2 THEN response.write "class=""errorItem"""%>/>
    </p>
    
    <p>Email: <font color="#FF0000">*</font>
    <input name="email" size="30" type="text" id="email" value="<%=inputArray(3,2)%>" <%IF badItem=3 THEN response.write "class=""errorItem"""%>/>
    </p>
    
    <p>Location: <font color="#FF0000">*</font>
    <select name="location" id="location" value="%=inputArray(4,2)%>" <%IF badItem=4 THEN response.write "class=""errorItem"""%>/>
    <option value="Queen">King</option>
    <option value="King">Rosedale</option>
    <option value="Dundas">Forrest Hill</option>
    </select>
    </p>
    <p>Primary Fitness Goal: <font color="#FF0000">*</font><br>
    <textarea rows="3" cols="30" name="goal" type="text" id="goal" value="<%=inputArray(5,2)%>" <%IF badItem=5 THEN response.write "class=""errorItem"""%>/></textarea>
    </p>
    
    <p> 
    <input type="submit" value="Submit" />
    </p>
    
    </form>
    Last edited by Markus; Jun 1 '09, 09:46 AM. Reason: Added [code] tags.
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    This is an asp question and you should ask that question on that board.

    Comment

    • GazMathias
      Recognized Expert New Member
      • Oct 2008
      • 228

      #3
      You might want to fix this, for one:

      Code:
      value="%=inputArray(4,2)%>"
      Though as far as I know, select elements don't have a value attribute, as they are catered for by option elements.

      Can we also see how you are parsing this data?

      Gaz

      Comment

      • kip1790
        New Member
        • Jun 2009
        • 13

        #4
        Originally posted by GazMathias
        You might want to fix this, for one:

        Code:
        value="%=inputArray(4,2)%>"
        Though as far as I know, select elements don't have a value attribute, as they are catered for by option elements.

        Can we also see how you are parsing this data?

        Gaz

        Below is the ASP I'm using.....appre ciate the prompt response.I need to know how to populate the array with the option selected.....
        <%
        '============== =============== ====
        'All fields are acted as required
        ' except those the NAME of which
        ' is in this string variable:
        '============== =============== ====
        exceptions = Array("address" )

        '============== =============== ====
        'NAME of the e-mail field is
        ' stored in this string variable:
        '============== =============== ====
        emailField = "email"

        '============== =============== ====
        'Variables
        '============== =============== ====
        Dim EmailFrom
        Dim EmailTo
        Dim Subject
        Dim fname
        Dim lname
        Dim email
        Dim location
        Dim goal
        dim errorMessage, badItem, inputArray() : badItem=-1
        redim inputArray(50,4 )


        '============== =============== ====
        'Get all what is submitted
        '============== =============== ====
        IF request.Form.Co unt > 0 THEN
        execute("const numberOfFields =" & request.Form.Co unt)
        execute("redim inputArray("&nu mberOfFields&", 2)")
        FOR i = 1 TO request.Form.Co unt
        inputArray(i,1) = request.Form.Ke y(i)
        inputArray(i,2) = request.Form.It em(i)
        NEXT
        validate
        ELSEIF request.QuerySt ring.Count > 0 THEN
        execute("const numberOfFields =" & request.QuerySt ring.Count)
        execute("redim inputArray("&nu mberOfFields&", 2)")
        FOR i = 1 TO request.QuerySt ring.Count
        inputArray(i,1) = request.QuerySt ring.Key(i)
        inputArray(i,2) = request.QuerySt ring.Item(i)
        NEXT
        validate
        END IF

        SUB validate
        '============== =============== ====
        'Check for empty fields
        '============== =============== ====
        FOR i = 1 TO numberOfFields
        isException = False
        IF inputArray(i,2) ="" THEN
        FOR j = 0 to UBound(exceptio ns)
        IF inputArray(i,1) = exceptions(j) THEN isException = TRUE
        NEXT
        IF NOT isException THEN
        badItem = i
        errorMessage = "At least one of the required fields is left empty."
        EXIT SUB
        END IF
        END IF
        isException = False
        NEXT
        '============== =============== ====
        'Check email address for basic
        ' errors
        '============== =============== ====
        FOR i = 1 TO numberOfFields
        IF emailField=inpu tArray(i,1) THEN
        validationResul t = validateEmail(i nputArray(i,2))
        IF validationResul t <> "" THEN
        errorMessage = validationResul t
        badItem = i
        END IF
        END IF
        NEXT
        END SUB

        FUNCTION validateEmail(s trAddress)
        IF InStr(strAddres s,"@") < 2 THEN
        validateEmail = "Email address must contain ""@"" sign."
        ELSEIF InStr(Right(str Address,Len(str Address)-InStr(strAddres s,"@")),".") < 2 OR InStr(Right(str Address,Len(str Address)-InStr(strAddres s,"@")),".") = Len(strAddress)-InStr(strAddres s,"@") THEN
        validateEmail = "Email address must contain ""."" sign."

        END IF
        END FUNCTION


        %>
        <p>&nbsp;</p>
        <%
        IF errorMessage<>" " THEN
        %>
        <p class="errorMes sage">There was an error with your form: <b><%=errorMess age%></b></p>
        <%
        ELSEIF request.form.co unt = 0 AND request.form.co unt = 0 THEN
        %>
        <%
        ELSE
        EmailFrom = "kip1790@hotmai l.com"
        EmailTo = "kip1790@hotmai l.com"
        Subject = "Google Membership Request"
        fname = Trim(Request.Fo rm("fname"))
        lname = Trim(Request.Fo rm("lname"))
        email = Trim(Request.Fo rm("email"))
        location = Trim(Request.Fo rm("location") )
        goal = Trim(Request.Fo rm("goal"))

        Dim Body
        Body = Body & "First Name: " & fname & VbCrLf
        Body = Body & "Last Name: " & lname & VbCrLf
        Body = Body & "Email: " & email & VbCrLf
        Body = Body & "Location: " & location & VbCrLf
        Body = Body & "Primary Fitness Goal: " & goal & VbCrLf

        ' send email
        Dim mail
        Set mail = Server.CreateOb ject("CDONTS.Ne wMail")
        mail.To = EmailTo
        mail.From = EmailFrom
        mail.Subject = Subject
        mail.Body = Body
        mail.Send
        %>
        <font class="body">Th ank you, we will be in touch shortly.<p>&nbs p;</p><a href="http://www.totum.ca/">Click here to be directed to our website... </a></font>
        <%
        response.End
        END IF
        %>

        Comment

        Working...