Skip navigation
Currently Being Moderated

2 Form Fields, Same Data Except a Prefix and Suffix

Jul 30, 2012 11:08 AM

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?

 
Replies
  • George Johnson
    11,676 posts
    Aug 11, 2002
    Currently Being Moderated
    Jul 30, 2012 11:50 AM   in reply to Jeffrey_Smith

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points