473,511 Members | 16,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot post a Drop Down value...

13 New Member
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....

Expand|Select|Wrap|Line Numbers
  1. <form action="deliver.asp" method="post">
  2.  
  3. <p>First Name: <font color="#FF0000">*</font>
  4. <input name="fname" size="24" type="text" id="fname" value="<%=inputArray(1,2)%>" <%IF badItem=1 THEN response.write "class=""errorItem"""%>/>
  5. </p>
  6.  
  7. <p>Last Name: <font color="#FF0000">*</font>
  8. <input name="lname" size="24" type="text" id="lname" value="<%=inputArray(2,2)%>" <%IF badItem=2 THEN response.write "class=""errorItem"""%>/>
  9. </p>
  10.  
  11. <p>Email: <font color="#FF0000">*</font>
  12. <input name="email" size="30" type="text" id="email" value="<%=inputArray(3,2)%>" <%IF badItem=3 THEN response.write "class=""errorItem"""%>/>
  13. </p>
  14.  
  15. <p>Location: <font color="#FF0000">*</font>
  16. <select name="location" id="location" value="%=inputArray(4,2)%>" <%IF badItem=4 THEN response.write "class=""errorItem"""%>/>
  17. <option value="Queen">King</option>
  18. <option value="King">Rosedale</option>
  19. <option value="Dundas">Forrest Hill</option>
  20. </select>
  21. </p>
  22. <p>Primary Fitness Goal: <font color="#FF0000">*</font><br>
  23. <textarea rows="3" cols="30" name="goal" type="text" id="goal" value="<%=inputArray(5,2)%>" <%IF badItem=5 THEN response.write "class=""errorItem"""%>/></textarea>
  24. </p>
  25.  
  26. <p> 
  27. <input type="submit" value="Submit" />
  28. </p>
  29.  
  30. </form>
Jun 1 '09 #1
3 2867
drhowarddrfine
7,435 Recognized Expert Expert
This is an asp question and you should ask that question on that board.
Jun 1 '09 #2
GazMathias
228 Recognized Expert New Member
You might want to fix this, for one:

Expand|Select|Wrap|Line Numbers
  1. value="%=inputArray(4,2)%>"
  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
Jun 1 '09 #3
kip1790
13 New Member
@GazMathias

Below is the ASP I'm using.....appreciate 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.Count > 0 THEN
execute("const numberOfFields =" & request.Form.Count)
execute("redim inputArray("&numberOfFields&",2)")
FOR i = 1 TO request.Form.Count
inputArray(i,1) = request.Form.Key(i)
inputArray(i,2) = request.Form.Item(i)
NEXT
validate
ELSEIF request.QueryString.Count > 0 THEN
execute("const numberOfFields =" & request.QueryString.Count)
execute("redim inputArray("&numberOfFields&",2)")
FOR i = 1 TO request.QueryString.Count
inputArray(i,1) = request.QueryString.Key(i)
inputArray(i,2) = request.QueryString.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(exceptions)
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=inputArray(i,1) THEN
validationResult = validateEmail(inputArray(i,2))
IF validationResult <> "" THEN
errorMessage = validationResult
badItem = i
END IF
END IF
NEXT
END SUB

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

END IF
END FUNCTION


%>
<p>&nbsp;</p>
<%
IF errorMessage<>"" THEN
%>
<p class="errorMessage">There was an error with your form: <b><%=errorMessage%></b></p>
<%
ELSEIF request.form.count = 0 AND request.form.count = 0 THEN
%>
<%
ELSE
EmailFrom = "kip1790@hotmail.com"
EmailTo = "kip1790@hotmail.com"
Subject = "Google Membership Request"
fname = Trim(Request.Form("fname"))
lname = Trim(Request.Form("lname"))
email = Trim(Request.Form("email"))
location = Trim(Request.Form("location"))
goal = Trim(Request.Form("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.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
%>
<font class="body">Thank you, we will be in touch shortly.<p>&nbsp;</p><a href="http://www.totum.ca/">Click here to be directed to our website... </a></font>
<%
response.End
END IF
%>
Jun 2 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2454
by: PT | last post by:
I got a form with many text boxes, checkboxes and 3 drop downs. From that 3, 2 are dependant. I can choose one drop down, and the next drop down should display the dependant values of the first...
1
2884
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
0
1213
by: San Diego Guy | last post by:
Hi all! I have Datagrid. Within that datagrid I have a drop down list that I set up some values in (a "collection") I set up an edit command column on the datagrid and wrote simple code to get...
2
12595
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
5
4204
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
1
7946
by: Rob Meade | last post by:
Hi all, I post back to my page if the form hasn't been submitted with the required information. I would like to with a little javascript, auto-select an option in the drop down list on my page....
2
10496
by: OceanBreeze | last post by:
I am using ASP.Net 2.0 and C# and new to this. I have programmatically added a zip code drop down into web form inside Page_Load method as: ZipDropDown.Items.Add("11111");...
1
1640
by: tsunethere | last post by:
hi .. I have 2 drop-down boxes. at first when web page will get load value this drop-down value will be"---" in this fashion. and 2nd drop-down will be disabled. unless and until user selects...
2
3190
by: leeperman | last post by:
In Dreaweaver I cannot filter my database results to display only specific data that is retrieved from mulptile drop down list on my search page. The drop down list selections are posted to my...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.