Link to home
Start Free TrialLog in
Avatar of N1nja
N1nja

asked on

ASP Javascript CDOSYS Form to Email Example

I'm in need of a ASP Javascript CDOSYS Form to Email Example. All I've found so far is examples for VBScript and I can't seem to convert it across.
Avatar of sajuks
sajuks

CDOSYS works only at the server level . Javascript will be used only to check client side validans.
Cbscript is used might be only for validn.
What are you looking for ? Maybe if you post what you've got and explain what you want we might
be able to help you.
Avatar of N1nja

ASKER

I use JScript/JavaScript as the ASP Programming Language.

I have multiple forms that previously used CDONTS, but I want to use CDOSYS and need code examples in JavaScript. The only examples I can find are coded in VBScript.
the mail that is sent  using  CDOSYS  is ASP language. Javascript doent come in the picture over here.
Thats why am trying to find out why you need javascript ? is it to validate your form or what ?
An example or a link would be better  to illustarte your problem

Its an example using dreamweaver, but  it might be what you are searching for
http://www.cgw3.co.uk/tutorials/tutorial.asp?TutorialID=39&CategoryID=3
Avatar of N1nja

ASKER

Do you program ASP? If yes, What Language do you use?


I USE JAVASCRIPT.


I use JavaScript for ASP (Active Server Pages) which runs at the server (Server Side).

I will be using JavaScript for validation (Client Side) when I have completed the Form and CDOSYS Page.
Avatar of N1nja

ASKER

Thanks but that example uses VBScript, not JavaScript.
Did you check the code . its a n asp page with javascrip validn done to ensure that no fields are empty.
If valid the form calls the thankyou.asp page which calls the CDOSYS object.
What can be simpler than that.
I hope you dont think that you can call this without asp ?
Avatar of N1nja

ASKER

I refer you to my previous comment:



Comment from N1nja
Date: 10/28/2004 11:35AM BST
 Your Comment  


Do you program ASP? If yes, What Language do you use?


I USE JAVASCRIPT.


I use JavaScript for ASP (Active Server Pages) which runs at the server (Server Side).

I will be using JavaScript for validation (Client Side) when I have completed the Form and CDOSYS Page.
Check my profile. I believe it speaks for itself.

Yes am involved in various web server languages like asp,jsp,php,powerdynamo.
Client side i prefer javascript.

What i want to simply state is that  create a simple asp page  save it something like mail.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
      <form action="thankyou.asp" method="post" name="fmcontact" id="fmcontact" onsubmit="return yourvalidn()">
        <input name="Name" type="text" id="Name" tabindex="1" onfocus="this.select();" size="50" />
        <input name="Email" type="text" id="Email" tabindex="1" size="50" />
        <textarea name="Details" cols="45" rows="10" id="Details" tabindex="1"></textarea>
        <input type="submit" value="Submit" tabindex="1" />
</form>
</body>

use the thankyou.asp page and se if it works or not.I believe you are getting a bit confused

Heres a simple validn script which i presume is soemthing you wanted to be sure i knew what you are talking about
// mail.asp page
<% %>
<head>
<script>
function yourvalidn()
{
if ( document.fmcontact.Name.value == "" )
{
alert ( "Enter Name")
return false
}
if ( document.fmcontact.Email.value == "" )
{
alert ( "Enter Email")
return false
}
if ( document.fmcontact.Details.value == "" )
{
alert ( "Enter Details")
return false
}
return true
}
</script>
</head>
<body>
      <form action="thankyou.asp" method="post" name="fmcontact" id="fmcontact" onsubmit="return yourvalidn()">
        <input name="Name" type="text" id="Name" tabindex="1" onfocus="this.select();" size="50" />
        <input name="Email" type="text" id="Email" tabindex="1" size="50" />
        <input name="Details" cols="45" rows="10" id="Details" >
        <input type="submit" value="Submit" tabindex="1" />
      </form></td>
</body>

the thankyou.asp page you already have
Avatar of N1nja

ASKER

You might have a great looking profile, but that doesn't mean a thing if you don't understand me.

This is some of what you have sent me:
******************************************************************
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
      <form action="thankyou.asp" method="post" name="fmcontact" id="fmcontact" onsubmit="return yourvalidn()">
        <input name="Name" type="text" id="Name" tabindex="1" onfocus="this.select();" size="50" />
        <input name="Email" type="text" id="Email" tabindex="1" size="50" />
        <textarea name="Details" cols="45" rows="10" id="Details" tabindex="1"></textarea>
        <input type="submit" value="Submit" tabindex="1" />
</form>
</body>
******************************************************************

May I point out this line:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

It tells the server that the programming script used is VBScript not JavaScript as I have stated till I am blue in the face.

Also validation JavaScript is not an issue, I can write that script myself.


In my next comment I will give you an example of my JavaScript ASP.
Avatar of N1nja

ASKER

Example Code:

*****************************************************************
<%@ Language=JavaScript %>
<%
var folderPrefix = "";
var navTitle = "home";
var pageTitle = "Home";
%>
<!-- #include file="site_content.asp" -->
<%
function getLeftNav()
{
      var sOut = "";
      sOut += openTable("left",leftWidth, "", navTitle);
      sOut += "<tr><td width=\"196\"></td></tr></table>";
      return sOut;
}
*****************************************************************

This is the first section of the default.asp page.
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of N1nja

ASKER

Will check it out in the next hour.

Did you understand what I was saying in above discussion.
The discussion was about the Script Language you can use on a ASP-page?
You use JScript (or Javascript), sajuks thought you could only use VBscript to make ASP. Wich is not true. VB is the most used Server sided script (javascript the most client-sided script) But they work both fine server-sided. You can even use other languages (third-party lang) in ASP scripts. The third-party languages should be installed then.
So it was an unusefull discussion. But I found it funny, because you were talking next to each other. Correct me if I thought wrong =)
Hope the script works. I'm not that good in Javascript server-sided.

kGenius
Hope the script works, I can use the points ;)
Avatar of N1nja

ASKER

It's the best thing I've found yet, can you tell me where you found/learnt this example.

In reference to the discussion I knew that "sajuks" didn't quite understand me but I understood him, strange on his part because he is a JavaScript Expert apparently.
Avatar of N1nja

ASKER

Sorry to split it but surely he needs some encouragement.