474,047 Members | 38,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple question: translate select values into a hidden text box

hello:

everybody! I have a simple question. How can I translate the selected
value
from art to recipient(hidde n input button)?
<form name="send" method="post" action="send.cg i">
<select name="art" size="1" style=font-size:9pt onChange="Setva lue()">
<option value="ad2">ad</option>
<option value="editor2" >editor</option>
<option value="club2">c lub</option>
<option value="reguser2 ">reguser</option>
<option value="webmaste r2">webmaster </option>
<option value="event2"> event</option>
</select>

<INPUT type=hidden value=REMOTE_HO ST,HTTP_USER_AG ENT,REMOTE_ADDR
name=env_report >
<INPUT type=hidden value="" name=recipient>
<INPUT type=hidden value=http://www.emkt.com.cn/survey/submit_kotter.s html
name=redirect>

pls help me !

thanks!
Jul 20 '05 #1
6 2531
On 24 Feb 2004 02:13:02 -0800, calfliu <ca*****@21cn.c om> wrote:
everybody! I have a simple question. How can I translate the selected
value from art to recipient (hidden input button)?
Why do you need to? Why not name the select element, recipient?

If you *need* to transfer the value between the controls, users with
JavaScript disabled will be unable to use the form. Consider the effects
of that carefully before you continue with this approach.

To answer your question, use the following:

var mailForm = document.forms[ 'send' ];
mailForm.recipi ent.value =
mailForm.art.op tions[ mailForm.art.se lectedIndex ].value;

As for you HTML, you should *always* place attribute values in quotation
marks (single or double). For the form values in env_report, and redirect,
you *must* use quotation marks. The commas and slashes in each control,
respectively, produce invalid HTML without quotes.

The attributes currently lacking quotes in the HTML below are:

select: style
input (env_report): type, value, name
input (recipient): type, name
input (redirect): type, value, name
<form name="send" method="post" action="send.cg i">
<select name="art" size="1" style=font-size:9pt onChange="Setva lue()">
<option value="ad2">ad</option>
<option value="editor2" >editor</option>
<option value="club2">c lub</option>
<option value="reguser2 ">reguser</option>
<option value="webmaste r2">webmaster </option>
<option value="event2"> event</option>
</select>

<INPUT type=hidden value=REMOTE_HO ST,HTTP_USER_AG ENT,REMOTE_ADDR
name=env_report >
<INPUT type=hidden value="" name=recipient>
<INPUT type=hidden
value=http://www.emkt.com.cn/survey/submit_kotter.s html
name=redirect>


Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
In article <op************ **@news-text.blueyonder .co.uk>,
Michael Winter <M.******@bluey onder.co.invali d> wrote:
To answer your question, use the following:

var mailForm = document.forms[ 'send' ];
mailForm.recipi ent.value =
mailForm.art.op tions[ mailForm.art.se lectedIndex ].value;

In addition, you need to invoke the above two lines. Add:

<form name="send" method="post" action="send.cg i"
onSubmit="adjus tForm()">

in the <head> section place

<SCRIPT type="text/javascript">
function adjustForm {

var mailForm = document.forms[ 'send' ];
mailForm.recipi ent.value =
mailForm.art.op tions[ mailForm.art.se lectedIndex ].value;

}
</script>

Robert
Jul 20 '05 #3
but it doesn't work. the send.cgi is just Formmail.cgi.wh en I submit
the form there display :
Error: Bad/No Recipient

There was no recipient or an invalid recipient specified in the data
sent to FormMail. Please make sure you have filled in the recipient
form field with an e-mail address that has been configured in
............... ...

you know the in the formmail. the recipent is :

Field: recipient
Description: This form field allows you to specify to whom you wish
for your form results to be mailed. Most likely you will want to
configure this option as a hidden form field with a value equal to
that of your e-mail address.

As of version 1.8, You can include multiple recipients by separating
the values with commas.
Syntax:
<input type=hidden name="recipient " value="em***@yo ur.host.com"> OR
<input type=hidden name="recipient "
value="us**@you rhost.com,us*** @yourhost.com">

so what shall I do. pls help
Jul 20 '05 #4
1) Check to see if you got some javascript error.
You have to turn on error reporting in IE.
In netscape, type in javascript on the command line

2) Put out on alert on the function to see the value of the email address:

<SCRIPT type="text/javascript">
function adjustForm {

var mailForm = document.forms[ 'send' ];
mailForm.recipi ent.value =
mailForm.art.op tions[ mailForm.art.se lectedIndex ].value;

alert("recipien t = " + mailForm.recipi ent.value );

}
</script>

Robert
Jul 20 '05 #5
[The post below is the reply to an e-mail sent by the OP. The return
address couldn't be found by my mail server, so I've replied here]

On Wed, 25 Feb 2004 10:38:30 +0800, Karl Liu <ca*****@21cn.c om> wrote:
Mr Winter: thanks for your help! But it did not work according to
your code. I use the formmail.cgi. so the code is:
The snippet of code I provided does work. However, Robert's follow-up
introduced some syntax errors.

I've indicated corrections for both the script and your HTML below.
<html>
<head>
<title>*国 销**网 > 联系方法</title>
<meta http-equiv="Content-Type"
content="text/html; charset=gb2312" >
<link rel="stylesheet " href="/doc-sys/emkt.css"
type="text/css" TITLE="EMKT">
<SCRIPT type="text/javascript">
function adjustForm {
The line above is where the problem lies. The function declaration is
missing the required parameter list. It should read:

function adjustForm() {

Please continue to read below.
var mailForm = document.forms[ 'send' ];
mailForm.recipi ent.value =
mailForm.art.op tions[ mailForm.art.se lectedIndex ].value;
} </script>
</head>
<body bgcolor="#FFFFF F" leftmargin="0" topmargin="4">
[snipped menu table and SSI include]
<TABLE border=0 cellPadding=3 cellSpacing=0 width="100%">
<TR>
<td>
<br><br>
<P class="title" align="center"> 联系方法</P>
<div class="11pt"><b >深圳市麦 特企业顾 有限公司</b><br>
   电话 :0755-26936136 (总机转)<br>
   *真 :0755-26936158<br>
   地址 :深圳市南 山区华侨城 汉唐大厦230 1室<br>
   邮编 :518053<br>
<P align="center">
<a href="http://www.emkt.com.cn/intro/emkt_beijing.ht ml"
>麦肯特北 公司</a>  <a href="http://www.emkt.com.cn/intro/emkt_shanghai.h tml"
>麦肯特上 公司</a> 

<a href="http://www.emkt.com.cn/intro/emkt_wuhan.html "
>麦肯特* 公司</a>

</div>
</p>


The nesting here is incorrect. The closing P tag should appear before the
DIV tag:

</p>
</div>
<form name="send" method="post"
action="/cgi-sys/send.cgi" onSubmit="adjus tForm()">
[snipped first table in form]
<P align=center>
<input type=hidden name="required" value="姓名, *邮件">
<INPUT type=hidden value=REMOTE_HO ST,HTTP_USER_AG ENT,REMOTE_ADDR
name=env_report >
<INPUT type=hidden name=redirect
value=http://www.emkt.com.cn/survey/submit_kotter.s html>
The value attributes of the two INPUT elements above *must* be enclosed in
quotes. Even if browsers like IE parse them correctly, there *will* be
browsers that won't and your page will be not work as you intended with
them.
<INPUT type="hidden" name="recipient ">
<INPUT type=submit value=提交 name=Submit>
<INPUT type=submit value=重填 name=Submit2>
The two value attributes above appear to contain non-Latin characters.
These too must be quoted.
</P>
</FORM>


[snipped some end tags]

Hope that helps,
Mike
Jul 20 '05 #6
On 24 Feb 2004 09:21:09 -0800, Robert <rc*******@my-deja.com> wrote:
In article <op************ **@news-text.blueyonder .co.uk>,
Michael Winter <M.******@bluey onder.co.invali d> wrote:
To answer your question, use the following:

var mailForm = document.forms[ 'send' ];
mailForm.recipi ent.value =
mailForm.art.op tions[ mailForm.art.se lectedIndex ].value;


In addition, you need to invoke the above two lines. Add:

<form name="send" method="post" action="send.cg i"
onSubmit="adjus tForm()">

in the <head> section place

<SCRIPT type="text/javascript">
function adjustForm {


You mean,

function adjustForm() {

[snip]

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8077
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as expected with alphabet and number characters and the ' (single quote &apos; entity) character but does not work if a double quote character " is part of the string to filter on This returns all Vendor Names that begin with A (either case)
4
2179
by: Gadrin77 | last post by:
I have data that looks like <Root> <Main Value="Line1|Line2.|Line3|Line4.|Line5"/> </Root> I'm using Translate(@Value, "|.", ",")
15
2173
by: C White | last post by:
I've got another drop list problem I am using the following code where users select a name, but it should pass a name and email into the table <select name="user"> <option value="<% Response.Write (rsUser("Name")) %>"> <% Response.Write (rsUser("Name")) %> <input type="hidden" name="Email" value="<% Response.Write (rsUser("Email")) %>">
11
2733
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
7
2041
by: | last post by:
I can't get IE 6 to read the values in my <SELECT..> data entry fields. Netscape 7 and Opera see them, and IE will pass the values to the database, but the javascript validation script gets a null value from the selection fields. Text inputs work just fine. Below is the form and validation script (I've added "...." to indicate additional fields in the same format in both the form and the validation) Here's the form:
13
1881
by: Saber | last post by:
I did a lot of searches and read something about datagrids. But I couldn't find the answer of my simple question, how can I show only my desired columns of a table? for example I wrote this sql query: OleDbDataAdapter1.SelectCommand.CommandText = & _ "Select illNameE From tblIllness" OleDbDataAdapter1.Fill(DsIllness1) But in my datagrid, I get (null) for other ccolumns instead
4
2402
SHOverine
by: SHOverine | last post by:
I have a 3-part form that I am having trouble with. First part is to select the user group and the week and year that I want to submit results for, this calls the elements that I want to update. The second part is to enter the results and submit them to a MySQL table called results the final part echoes the results. The issue is that my form writes the elements that I called up to the this table before I enter the results and click...
6
1685
by: Ronald Raygun | last post by:
I want to be able to randomly select the following from an array: 1). An image 2). A piece of text (name of tge image) 3). A piece of text (description of the image) I want to be able to build a static array with the values hardcoded into the array, and then be able to randomly select an item from the array and retrieve the image, name and description.
0
10548
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
11604
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...
1
12036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11145
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
10316
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8701
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4947
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3976
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.