473,671 Members | 2,601 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 2873
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.....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
%>
Jun 2 '09 #4

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

Similar topics

6
2458
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 drop down chosed. And I have a submite button to submit all these values to DB. First problem: I cant keep the value of the selected text in the first drop down. It always goes back to the first value. (but the asp site extension changes...
1
2903
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 text boxes? What this script is suppose to do is change the value of a second drop down list based on the selection from the first. Then a value is chosen from the script generated drop down list in the
0
1220
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 me in to edit mode: sub dgEdit(ByVal s As Object, ByVal e As DataGridCommandEventArgs) dgStatus.EditItemIndex = e.Item.ItemIndex bindData() 'This is just a sub I wrote to re-bind the data
2
12612
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 select any skill in 1st drop down list then i'll select % of this skill in the 2nd list box , based on the percentage i've selected in the 2nd list box it has to display 2 sets of drop down list boxes at run time one for selecting skill and
5
4219
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); System.Data.SqlClient.SqlCommand dbCommand1 = new System.Data.SqlClient.SqlCommand();
1
7949
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. The drop down list is called lstCountry I will have in an ASP variable the country code which was the value of the selected item when the form was posted...
2
10522
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"); ZipDropDown.Items.Add("22222"); ZipDropDown is the drop down control on the web page. I have created a protected void ZipDropDown_SelectedIndexChanged(object sender, EventArgs e) method in my corresponding .cs file for the .aspx file. protected void...
1
1647
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 item from 1st drop-down 2nd will be disabled. As soon as user enter value in 1st drop-down, 2nd will get enabled and user can select value in 2nd drop-down!I want to do it server side with perl only. I want to do like this : if (value in drop-down1...
2
3201
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 display page by GET. How do i write my sql code so to only display info where TOWN = "Town selected from list" AND BEDS ="No of Beds selected from list My search page form is below <form action="tsearchresults.asp" method="get" name="townSearchForm"...
0
8485
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8403
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8677
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5704
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.