I have built the following script in an attempt to create a submit button that will automatically save the document in a different directory on my computer. It will also use the form field data "customer" and "date" to generate the filename. I printed out the variable myPath and it looks like it printed the correct string. I keep getting the following error:
TypeError: redeclaration of const path
any help would be much appreciated.
var customer = this.getField("Customer").value;
var date = this.getField("Date").value;
var path = "C:/Users/awilliams/My Documents/Test/"
var reg = date.match(/(\d+)\/(\d+)\/(\d+)/);
var myPath= "C:/Users/awilliams/My Documents/Test/" + customer + "_" + reg[1] + "." + reg[2] + "." +
reg[3] + ".pdf";
this.saveAs(myPath);