Button for emailing

creo6746

22-12-2017

I have a fillable form and created a button that users can click on to send to a name that is entered in a text field named Manager.  In the script editor I have the following:

Subject.#subform[0].EmailManager::click - (JavaScript, client)

//Create a variable to hold the document object

var oDoc = event.target;

oDoc.mailDoc({

bUI: true,

cTo: Manager.formattedvalue,

cSubject: Location.formattedvalue + Department.formattedvalue + Subj.rawValue

});

(FYI..Location and department are dropdown boxes and subj. is a text box that already has preset value to it)

When I go to test the form, it doesn't email the name that's in the text field.  Does the cTo: have to be a raw.value? 

What am I missing?????? 

Accepted Solutions (0)

Answers (1)

Answers (1)

radzmar

MVP

02-01-2018

The formattedValue is a field's rawValue modified by a pattern. You'll use those generally on numeric or date fields but not in dropdown lists.

Use the rawValue instead like this way:

// Declare variables

var oDoc = event.target,

cTo = Manager.isNull ? "" : Manager.rawValue, // If field is empty return empty string instead of null

cSub = (Location.isNull ? "" : (Location.rawValue + " ")) + (Department.isNull ? "" : (Department.rawValue + " ")) + (Subj.isNull ? "" : Subj.rawValue);

// Send form

oDoc.mailDoc({

bUI: true,

cTo: cTo,

cSubject: cSub

});