Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Javascript- Mandatory -Optional

Hi,

I am using following code for sending interactive form through E-mail & also CCing to 5 people.

I need an option to make CC fields(CEmail) as optional & email field(IEMAIL) as mandatory.

var lEmail = xfa.record.ITEM.PEMAI.value;
var CEmail = xfa.record.ITEM.PPCC1.value+";"+xfa.record.ITEM.PPCC2.value+
";"+xfa.record.ITEM.PPCC3.value+";"+xfa.record.ITEM.PPCC4.value+";"
+xfa.record.ITEM.PPCC5.value;
var myDoc = event.target;
try {
  myDoc.mailDoc({
    bUI: false,
    cTo: lEmail,
    cCc: CEmail,
    cSubject: "Document",
    cMsg: "Dear Customer,.........."
    });
} catch (e)

What code changes should I make? becasue i am getting a message saying"null" is not acceptable.

Rgds

vara

Former Member
Former Member replied

Hi,

For the send or submit button check whether the EmailId field is null or not and display an error message, for CC Email dont check for mandatory , but use the code as below;


var lEmail = xfa.record.ITEM.PEMAI.rawValue;
var CEmail = xfa.record.ITEM.PPCC1.rawValue+";"+xfa.record.ITEM.PPCC2.rawValue+
";"+xfa.record.ITEM.PPCC3.rawValue+";"+xfa.record.ITEM.PPCC4.rawValue+";"
+xfa.record.ITEM.PPCC5.rawValue;

if ( IEmail == null )
{
    xfa.host.messageBox("Please enter the Email");
}
elseif
{
   if ( xfa.record.ITEM.PPCC1.rawValue != null || xfa.record.ITEM.PPCC2.rawValue != null ||
        xfa.record.ITEM.PPCC3.rawValue != null || xfa.record.ITEM.PPCC4.rawValue != null ||
        xfa.record.ITEM.PPCC5.rawValue != null )
   {
       var myDoc = event.target;
       try {
               myDoc.mailDoc({
               bUI: false,
               cTo: lEmail,
               cCc: CEmail,
               cSubject: "Document",
               cMsg: "Dear Customer,.........."
               });
        } catch (e)
    }
    else
    {
       var myDoc = event.target;
       try {
               myDoc.mailDoc({
               bUI: false,
               cTo: lEmail,
               cSubject: "Document",
               cMsg: "Dear Customer,.........."
               });
        } catch (e)
    }
}

Thanks and Regards

Pradeep Goli

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question