1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Please Help - Java Script not working

Discussion in 'JavaScript' started by djr2021, Nov 25, 2021.

  1. #1
    Hi,
    Please see below and let me know if I am missing something as it is not working.
    everything works, but I'm trying to get javascript to pull the field "MTRF Number" from the PDF and add that into the body of the text, however, when I activate that script, the body of the email just ends with "This is your Order number:"


    //submit button
    
    this.mailDoc({cTo: orderfulfillmenthub@email.ca,
    cSubject: this.getField("Province Dropdown").valueAsString + " - " + this.getField("Site Name").valueAsString + " - " + this.getField("DATE REQUESTED").valueAsString + " - " + this.getField("MTRF Number").valueAsString,
    cMsg: "Thank you for submitting your request to the Order Fulfillment Hub.\n" + "\n\nPlease allow three to five days for orders to arrive on site. Your order number is:"}); (this.getField("MTRF Number").valueAsString);
    Code (markup):
     
    Last edited by a moderator: Nov 25, 2021
    djr2021, Nov 25, 2021 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #2
    Adding some formatting I think points out the problem.

    
    this.mailDoc({
    
    	cTo : orderfulfillmenthub@email.ca,
    	
    	cSubject :
    		this.getField("Province Dropdown").valueAsString + " - " +
    		this.getField("Site Name").valueAsString + " - " +
    		this.getField("DATE REQUESTED").valueAsString + " - " +
    		this.getField("MTRF Number").valueAsString,
    	
    	cMsg: "Thank you for submitting your request to the Order Fulfillment Hub.\n\n\n\Please allow three to five days for orders to arrive on site. Your order number is:"
    	
    });
    
    (this.getField("MTRF Number").valueAsString);
    
    Code (markup):
    Can you see it? Your cTo lacks quotes for the string, and the getField for the string is AFTER the mailDoc's object instead of added inside it.

    Did you mean:

    this.mailDoc({
    
    	cTo : "orderfulfillmenthub@email.ca",
    	
    	cSubject :
    		this.getField("Province Dropdown").valueAsString + " - " +
    		this.getField("Site Name").valueAsString + " - " +
    		this.getField("DATE REQUESTED").valueAsString + " - " +
    		this.getField("MTRF Number").valueAsString,
    	
    	cMsg: "Thank you for submitting your request to the Order Fulfillment Hub.\n\n\n\Please allow three to five days for orders to arrive on site. Your order number is:" + this.getField("MTRF Number").valueAsString
    	
    });
    Code (markup):
    This is why professionals don't slop everything onto one line. Format your code, it can save you SO many headaches because it makes such fumbles a lot clearer.

    "There are two methods in software design. One is to make the program so simple, there are obviously no errors. The other is to make it so complicated, there are no obvious errors." -- Tony Hoare

    I consider formatting to be part of that simplicity.
     
    Last edited: Dec 2, 2021
    deathshadow, Dec 2, 2021 IP