Expand my Community achievements bar.

SOLVED

email submit fails without Cc email address

Avatar

Former Community Member

Hello all,

I have a form with two email address fields. One field holds the To: address and the other holds the Cc: address.

When both fields are populated, the email submit functions as expected.

I have set the submit button to check and see if an email address is present in the To: field and if that field is empty it will not allow the submit to go further. However, when the Cc: address is missing, Outlook throws up an error message saying "Microsoft Outlook does not accept Null" and asks for an address.

How to get around this? There may be instances in which a Cc: address will not be needed or provided by the user.

I would like for the submit to work as long as at least one email address is available in the To: field. 

The second part of the question is, since the email address fields are simple text fields, what is the best way of entering more than two addresses in a single field. Would the addresses have to be separated by a comma, or semi-colon etc, for this to work with Outlook?

I would appreciate any suggestions.

Harry Ohm.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Harry,

I am out of the office and doing this on the phone, so i'll keep it brief.

If you wrap the line where you declare the oCC variable, in an if/else statement:

if (form1.page1.wrapper.Config.Email2.rawValue == null)

{

var oCC = "";

}

else

{

var oCC = form1.page1.wrapper.Config.Email2.rawValue;

}

This way if the cc field is blank, the variable will not be null, it will be a string of zero length.

Niall

View solution in original post

4 Replies

Avatar

Level 10

Hi Harry,

I have two examples here: http://assure.ly/fiTm2i

One is for users with Acrobat/Reader version 9.1 or above. The other is for earlier versions.

If you have a look at the third button in each example, you will see that I have placed the vCC variable AFTER the body string and BEFORE the submit as string. This is to suit the syntax.

Earlier in the script you will see that I declare the vCC as "" and then if the user has provided a cc address then the script assigns this

vCC = "&cc=" + ccEmail.rawValue;

Hope that helps,

Niall

Assure Dynamics

Avatar

Former Community Member

Hi Niall,

Thanks for your quick response. I was using the method below:



var myDoc = event.target;

var oEmail = form1.page1.wrapper.Config.Email1.rawValue;

var oCC = form1.page1.wrapper.Config.Email2.rawValue;

var oSub = form1.page1.wrapper.Config.subject.rawValue;

var oBody = form1.page1.wrapper.Config.body.rawValue;

   

    myDoc.mailDoc({

        bUI: false,

        cTo: oEmail,

        cCc: oCC,

        cSubject: oSub,

        cMsg: oBody,

        cSubmitAs: "PDF"

        });


I'm trying to understand how your method works. If there is no Cc address provided, then does the script omit the cc address completely from the mailto: url?
               vCC = "&cc=" + ccEmail.rawValue;
If the ccEmail address is not provided, the cc address is still null, and this is still passed to Outlook or the email client, right? I'll admit to being very confused.
Is there a workaround for the mailDoc method above?
Thanks again,
Harry.

Avatar

Correct answer by
Level 10

Hi Harry,

I am out of the office and doing this on the phone, so i'll keep it brief.

If you wrap the line where you declare the oCC variable, in an if/else statement:

if (form1.page1.wrapper.Config.Email2.rawValue == null)

{

var oCC = "";

}

else

{

var oCC = form1.page1.wrapper.Config.Email2.rawValue;

}

This way if the cc field is blank, the variable will not be null, it will be a string of zero length.

Niall

Avatar

Former Community Member

Many thanks Niall! Works like a charm!

Harry.