7 Replies Latest reply on May 11, 2013 5:43 AM by Test Screen Name

    Editing within a Merged field

    Sully7909

      Hi Everyone,

       

      I have a javascript that allows me to merge three fields into a single field.

       

      if (event.value != "1"){

      var firstName = this.getField("Trustee 1 First Name").value

      var midInitial = this.getField("Trustee 1 MI").value

      var lastName = event.value

       

       

      this.getField("Trustee 1 Name").value = firstName + " " + midInitial+ ". " + lastName

       

       

       

      }

       

      The problem is, I can only make edits to the three fields populating the merged field. I need to be able to revese edit from the merged field to the individual fields too. Any ideas?

       

      Thank you!!!

       

      C

        • 1. Re: Editing within a Merged field
          Bernd Alheit Adobe Community Professional & MVP

          What you mean with "revese edit" ?

          • 2. Re: Editing within a Merged field
            Sully7909 Level 1

            I need to edit the merged field, so that it makes a change to the original field. For example: field 1: Name, field 2: Initial, field 3: last name, Merged field; name, initial and last name. If I edit my last name in the merged field, field 3 should also change.

             

            Thank you for your help!

            • 3. Re: Editing within a Merged field
              Test Screen Name Most Valuable Participant

              The first thing with writing code is defining what you want it to do. Consider the following things typed into the "full name" field...

              Arthur C Clarke

              A E van Vogt

              Martin Luthor King

              Lester del Rey

              Wu

              Reagan,Ronald

              John D Rockerfeller, III

              What would you like to be set for first, initial, last in each of these cases?

              • 4. Re: Editing within a Merged field
                Sully7909 Level 1

                Arthur C Clarke (Arthur: First, C: Middle, Clarke: Last)

                A E van Vogt (AE: First, van Vogt: Last)

                Martin Luthor King ( Martin: First, Luthor: Middle, King: Last)

                Lester del Rey (Lester: First, del Rey: Last)

                Wu (Last)

                Reagan,Ronald (Reagan: Last, Ronald: First)

                John D Rockerfeller, III (John: First, D: Middle, Rockefeller, III: Last)

                 

                Thank you,

                 

                C

                • 5. Re: Editing within a Merged field
                  try67 MVP & Adobe Community Professional

                  And how should the script know what goes where? There's no consistency in it... You will need to define very exact rules as to what is a middle name, what is a last name and what is a first name, and even then it will more than likely go wrong for someone with an "unorthodox" name. Better let the user enter their own name in the way they see fit.

                  • 6. Re: Editing within a Merged field
                    MarkWalsh Level 4

                    Sully7909 wrote:

                     

                    Arthur C Clarke (Arthur: First, C: Middle, Clarke: Last)

                    A E van Vogt (AE: First, van Vogt: Last)

                    Martin Luthor King ( Martin: First, Luthor: Middle, King: Last)

                    Lester del Rey (Lester: First, del Rey: Last)

                    Wu (Last)

                    Reagan,Ronald (Reagan: Last, Ronald: First)

                    John D Rockerfeller, III (John: First, D: Middle, Rockefeller, III: Last)

                     

                    Thank you,

                     

                    C

                     

                    I believe you missed the point of the examples given, they were to demonstrate the difficulty in determining how to split the items (and even those examples are far from being inclusive of the problems you will encounter)

                     

                    I would suggest, as try67 did, that you leave the editing to the discrete fields instead of trying to parse out the full name. You will never be 100% accurate (do a google search on 'Full name parser'- you will often see suggestions to keep the data entry limited to discrete fields), although you may come close within your own parameters (but that may take an extensive amount of coding)

                     

                    But if you absolutely need to do this, I will give you some suggestions that may help get you started (which are by no means comprehensive):

                     

                    Split the full name (trim any spaces from the front and end first, and remove any multiple consecutive spaces) using a single space as the delimiter (you may  want to use a period and/or comma as well, but that may be better done after some initial processing), then check the end values looking for known titles/prefixes (Mr., Ms., Dr., Sir, etc.) and suffixes (Phd, IV, 3rd, Esq., Jr., Sr., etc.). Note that there can be more than one suffix (Jr. Phd, MD)

                     

                    Check the # of remaining values, if there is one value, put that into the last name.

                     

                    If more than one value, then check each value looking for surname prefixes (Von -, De -, Van de -, etc) and add them to the last name.

                     

                    Look for values with a single letter with/without period (A.J. or A. J. or A J). They may need to be split or combined.

                     

                    Check the # of remaining values:

                    1: last name

                    2: first name, last name (reverse if there is a comma at the end of the first value)

                    3: first name, middle name, last name (if there is a comma at the end of the first value, then last name, first name, middle name)

                    >3: You're on your own at this point. (simple solution - first value is first name, last is last name, and the rest are middle name, or choose your own compromise)

                     

                    Most importantly, give the user a dialog to show them exactly which values will be put into which fields, and allow them to cancel if it is incorrect.

                     

                     

                    And, once you've gone through all of that (assuming you haven't accepted the easy and accurate suggestion to just keep entry to the discrete fields), test against as large a dataset of names as you can (if you have sample data from your current forms, then use that as well as others)

                    • 7. Re: Editing within a Merged field
                      Test Screen Name Most Valuable Participant

                      Yes, that was my point. Humans can generally do a reasonable job of this, for names within their own culture at least. Though many English speakers would I think get confused about "von" and "del", and even with your human knowledge you managed to get one "wrong" (A E van Vogt - E is middle initial for Alfred Elton). I didn't even include punctuation e.g. in the otherwise identical

                      John W. Campbell, Jr.

                      John W Cambell Jr

                      Campbell, Jr, John W.

                      Cambpell Jr,John W

                       

                      It's possible to duplicate this human knowledge, but it requires first some very detailed specification of the exact rules then second very precising programming. And then exhaustive testing of course.

                       

                      It's an interesting project. I'm sure there has been academic research you could tap into. Not a project I'd tackle, though and here's why:

                       

                      People's own names are very personal and sensitive. A significant proportion of people are very upset if you get anything about their names wrong. Since splitting it up in this way could easily get it wrong, you are setting out to upset some of your clients/customers. Since the whole point, I imagine, of letting them type in over their full name is to be "user friendly" I assume this is important. Better to make it obviously read only, or leave it out.