Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Button for emailing

creo6746
Level 1
Level 1

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?????? 

1 Reply
radzmar
Level 10
Level 10

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

});