471,122 Members | 1,153 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

Changing Form Data

Hello:

I've done an exhaustive online search and either can't find what I'm looking
for or I'm unable to make what I've found work. I'm not a programmer, but
I'm sure that this is probably elementary stuff.

What I have is a form which is being POSTed to an ASP script which processes
the script and emails it to a specified recipient (which is set in a hidden
form field).

In this form, I have a popup menu of a list of items. Based on which menu
item is selected, I would like the recipient value to change accordingly.
The "value" of the menu item cannot be used as it is capturing other data.

For example:

<select name="country">
<option value="12345">USA</option> -- email to us***@xyz.com
<option value="45678">France</option> -- email to us***@xyz.com
<option value="98765">Spain</option> -- email to us***@xyz.com
</select>

As I said, there is a hidden field:

<input type="hidden" name="email" value="su*****@xyz.com">

So if someone selects "France", the email "su*****@xyz.com" changes to
"us***@xyz.com" and then the form is sent to the ASP script for processing.

If anyone has any insight or can point me to a site w/code which can help,
it would be greatly appreciated.

George

Jul 20 '05 #1
1 7120


George Rogic wrote:
Hello:

I've done an exhaustive online search and either can't find what I'm looking
for or I'm unable to make what I've found work. I'm not a programmer, but
I'm sure that this is probably elementary stuff.

What I have is a form which is being POSTed to an ASP script which processes
the script and emails it to a specified recipient (which is set in a hidden
form field).

In this form, I have a popup menu of a list of items. Based on which menu
item is selected, I would like the recipient value to change accordingly.
The "value" of the menu item cannot be used as it is capturing other data.

For example:

<select name="country">
<option value="12345">USA</option> -- email to us***@xyz.com
<option value="45678">France</option> -- email to us***@xyz.com
<option value="98765">Spain</option> -- email to us***@xyz.com
</select>

As I said, there is a hidden field:

<input type="hidden" name="email" value="su*****@xyz.com">

So if someone selects "France", the email "su*****@xyz.com" changes to
"us***@xyz.com" and then the form is sent to the ASP script for processing.

If anyone has any insight or can point me to a site w/code which can help,
it would be greatly appreciated.


If you use ASP on the server you should change the ASP page to examine
the posted data and then change the email as needed.
With client side JavaScript your form will only function correctly if
the user has a browser with JavaScript support enabled.
If you can't change the ASP page then you could use an onchange handler
<select
onchange="switch (this.selectedIndex) {
case 0:
this.form.email.value = 'w*******@whereever.tld';
break;
case 1:
this.form.email.value = 'w******@whereever.tld';
break;
...
}"
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Stefan Finzel | last post: by
4 posts views Thread by Tony W | last post: by
5 posts views Thread by Mark Fox | last post: by

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.