I have a 2 form fields. User will enter information (purchase order number) into Field 1. Field 2 will be a barcode font that requires the same digits, except with a starting asterisk and ending asterisk. These asterisks can not appear in Field 1. The number of digits that will appear in both fields will vary in length from 6 to 18 digits.
Example: Field 1: 123456 > Field 2: *123456*
Is there a way to have Field 2 auto fill with information from Field 1 and add the asterisks?
You can set up a custom calculate script for the second field that's something like:
// Get the value of the first field
var v = getField("Field 1").valueAsString;
// Add leading/trailing asterisks if not blank
event.value = v ? "*" + v + "*" : "";
Replace "Field 1" with the actual name of the field.
George, Thanks, that does the trick. At first, I had field 2 as a duplicate of field 1, and in this case, your script did not work. But after creating two separate form fields, with the script applied to field 2, then everything worked as expected.