Copy link to clipboard
Copied
I am trying to take the contents of a multi-line text field and split them into an array by the newline escape character but its not working at all.
For reference im trying to make it so that my boss can edit the staff members on a staffing form (as people are hired) by editing the text field, they would then be included in drop down menus.
var dropdownexample = this.getField("dropdownmenu")
var stafflist = this.getField("stafflist")
var arr = stafflist.value.split(/\n/);
dropdownexample.setItems(arr);
I am just confused why its not picking up the newline character... Im more accustomed to python where this isn't usually a problem. I would greatly appreciate any help y'all have to offer. Thanks!
Probably because the line-break character in multiline fields is "\r", not "\n"...
Copy link to clipboard
Copied
Probably because the line-break character in multiline fields is "\r", not "\n"...
Copy link to clipboard
Copied
ah yes this worked!