Jump to content

'If' to send an email


markwill2112

Recommended Posts

I am a JavaScript beginner and am teaching myself - slowly. I have managed to create two web forms that each when submitted post an .asp form that is in turn emailed to one of two email addresses (I inherited these so didn't create them originally but I have been modifying them).

 

There are two such web forms. When submitted, one posts one .asp form to one email address and the other to another address.

 

What I want to do is only have one web form instead of two and when particular choices from a drop-down list are chosen, that will post one of two .asp forms to the correct address.

 

The code for one of the forms is here: https://fileexchange.imperial.ac.uk/files/fb905b49d27/Form.html

 

I have copied below a section of the code from the above .html file. If e.g. 'A Practical Introduction to Problem Based Learning (PBL)' is selected from the list below, I want the form to post to this: action="http://www.imperial.ac.uk/ict/services/website/cms/help/edudev/emailfom.asp" method="post">

 

If e.g. 'Approaches to Teaching in Clinical Settings' is chosen from the list, I want the form to instead post to: action="http://www.imperial.ac.uk/ict/services/website/cms/help/edudev/emailnonfom.asp" method="post">

 

The two .asp files are here:

 

https://fileexchange.imperial.ac.uk/files/16d72adf49/emailfom.asp

https://fileexchange.imperial.ac.uk/files/ca24e268aab/emailnonfom.asp

 

What do I add to the script to make it do the above. I assume I need to use if (condition) {action1} but I have not been able to work it out.

 

 

<script type="text/javascript" type="text/JavaScript"><!--

 

function setOptions(chosen) {

var selbox = document.edudevcoursesbookingform.workshop_date;

 

selbox.options.length = 0;

if (chosen == "select the workshop title...") {

selbox.options[selbox.options.length] = new Option('Please select a workshop first',' ');

}

if (chosen == "A Practical Introduction to Problem Based Learning (PBL)") {

selbox.options[selbox.options.length] = new Option('Select workshop date','');

selbox.options[selbox.options.length] = new Option('19 September Waiting List','19 September Waiting List');

}

if (chosen == "Approaches to Teaching in Clinical Settings") {

selbox.options[selbox.options.length] = new Option('Select workshop date','');

selbox.options[selbox.options.length] = new Option('Contact EDU','Contact EDU');

}

if (chosen == "Giving Feedback and Formative Assessment") {

selbox.options[selbox.options.length] = new Option('Select workshop date','');

selbox.options[selbox.options.length] = new Option('27 June 2012','27 June 2012');

}

if (chosen == "Managing Challenging Groups in Problem Based Learning") {

selbox.options[selbox.options.length] = new Option('Select workshop date','');

selbox.options[selbox.options.length] = new Option('Contact EDU','Contact EDU');

}

if (chosen == "Portfolios in the Faculty of Medicine") {

selbox.options[selbox.options.length] = new Option('Select workshop date','');

selbox.options[selbox.options.length] = new Option('Contact EDU','Contact EDU');

}

if (chosen == "Teaching and Learning in the Faculty of Medicine") {

selbox.options[selbox.options.length] = new Option('Select workshop date','');

selbox.options[selbox.options.length] = new Option('17 July Waiting List','17 July Waiting List');

}

}

//-->

</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...