Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

< form >< select >< option > with two "value"-attribute... 1

Status
Not open for further replies.

Lupo

Programmer
Oct 29, 2001
31
CH
hi,

I have on my site a contact-
Code:
<form>
. this contact-
Code:
<form>
contains among other things a &quot;list of value&quot; (
Code:
<select>
-area) with approx. 190
Code:
<option>
-tags (it's a country list). each
Code:
<option>
-tag contains one value e.g.

Code:
<select name=&quot;country&quot;>
<option value selected></option>
<option value=&quot;a&quot;>A</option>
<option value=&quot;bb&quot;>BB</option>
....
<option value=&quot;zzzz&quot;>ABCDE</option>
</select>

the numbers of characters wihtin the
Code:
value
-attribute are different (1 - n). I hand over the content of the
Code:
value
-attribute to a cdonts-mail function asp-file (
Code:
sendmail.asp
). basing on this
Code:
value
-attribute the email should be sent to one of 2 different email-addresses.

Is there any possibility to handover two values of the above mentioned
Code:
<select>
-area to the
Code:
sendmail.asp
file? One of the
Code:
value
-attribute should contain the real country name and a 2nd
Code:
value
should contain an attribute for the selection of the email-address.

If it's not possible to do like this, what other solution would you recommend?

Thanks in advance for your help.

regards Lupo

WEB Designer & WEB Developer (as per my working contract) and ASP Newbie :)
 
Page 1

<option value=&quot;<%= email %>^<%= someothervalue %>&quot;>oisefj

Page 2

DIM optionSplit
optionSplit = SPLIT(REQUEST.FORM(&quot;selectField&quot;),&quot;^&quot;)
'the email = optionSplit(0)
'and the other value is optionSplit(1)
 
Hi cfk,

thx for yr tip. the coding within page 1 (contact.asp) works great. See the generated source code below.
Code:
  <select name=&quot;country&quot; size=&quot;1&quot;>
    <option value=emailaddr_1@mydomaine.com^Antarctica>Antarctica</option>
  ...
  </select>

Unfortunatelly, the code within page 2 (send_mail.asp) won't work. his the correct writting:

Code:
  'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
  Response.Buffer = True

  'Dimension variables
  Dim strBody                'Holds the body of the e-mail
  Dim objCDOMail             'Holds the mail server object
  Dim strMyEmailAddress      'Holds your e-mail address
  Dim strCCEmailAddress      'Holds any carbon copy e-mail addresses
  Dim strBCCEmailAddress     'Holds any blind copy e-mail addresses
  Dim strReturnEmailAddress  'Holds the return e-mail address of the user

  DIM optionSplit
  optionSplit(0) = SPLIT(REQUEST.FORM(&quot;Country&quot;),&quot;^&quot;)
  optionSplit(1) = SPLIT(REQUEST.FORM(&quot;Country&quot;),&quot;^&quot;)

  '--- Place your e-mail address in the following sting ---
  strMyEmailAddress = &quot;optionSplit(0)&quot;
  ...

Do I have a problem or am I the problem? Would be very glad if you could check out the code of page 2 (sendmail.asp).

thx in advance. rgds Lupo

btw, if it would help, I could send you the two a.m. files. WEB Designer & WEB Developer (as per my working contract) and ASP Newbie :)
 
Lupo, your Split is all wrong friend.

Instead of
====================================================
DIM optionSplit
optionSplit(0) = SPLIT(REQUEST.FORM(&quot;Country&quot;),&quot;^&quot;)
optionSplit(1) = SPLIT(REQUEST.FORM(&quot;Country&quot;),&quot;^&quot;)
====================================================

try
====================================================
DIM optionSplit
optionSplit = Split(Request.Form(&quot;Country&quot;),&quot;^&quot;)
====================================================

The Split method automatically populates the optionSplit array starting at element 0. So after the method executes, your optionSplit array would look like this:

optionSplit(0) = youremailaddy
optionSplit(1) = theothervalue

Clear as mud?
AT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top