11 Replies Latest reply on Dec 23, 2016 7:32 AM by RogerBirch

    Prevent repeated typing

    RogerBirch

      Would someone please remind me how I can have a partly filled field in my db on to which I complete it having tab onto it. i.e. A field with "16/" (16 depending on the year in another field) is automatically entered and when I tab onto the field, I can complete it with (say) "25". So I end up with the field saying 16/25.

      In this case, "16/" is the common factor and I would rather not have to type "16/" each time.

      Any suggestions greatfully received. Thanks.

        • 1. Re: Prevent repeated typing
          David Moyer

          Hi,

          you can use the OnObjectEnter script trigger on your field B, and make a script that populates field B with data from field A ...

          If ( IsEmpty(FieldB); FieldA & "/"; FieldB )

          • 2. Re: Prevent repeated typing
            RogerBirch

            Thanks David, but will this allow me to add an additional number after the "/" when I am editing the contact fields.

            I am using this in my guest contacts db, where I like to give each guest a number begining with 16/ (for the year 2016).

            What I am trying to achieve is NOT to have to type "16/" each time, just the additional number!

            • 3. Re: Prevent repeated typing
              RogerBirch

              So far I have done this:- If (Year="2015";"15/";If(Year="2016"; "16/";If(Year = "2017";"17/";""))) whichI think is similar to your suggestion, thanks, bu it is adding the second part of the field that I am struggling with!!

              • 4. Re: Prevent repeated typing
                alquimby

                Roger,

                 

                     In your subject field, make it auto enter "16/" & Self. Be sure to uncheck "Do Not Replace...etc." Enter your data, tab out of the field, and it will read 16/1whatever you typed.

                • 5. Re: Prevent repeated typing
                  erolst

                  RogerBirch wrote:

                  So far I have done this:- If (Year="2015";"15/";If(Year="2016"; "16/";If(Year = "2017";"17/";"")))

                  Allow me to suggest:

                   

                  Right ( theYear ; 2 ) & "/"

                   

                  or dynamically

                   

                  Right ( Year ( Get ( CurrentDate ) ) ; 2 ) & "/"

                  • 6. Re: Prevent repeated typing
                    David Moyer

                    I made my answer overly generic.  Combining my answer with Erolst's ...

                    (this prevents overwriting existing data)

                    If ( Isempty ( FieldB ); Right ( Year ( FieldA ); 2 ) & "/"; FieldB )

                    If FieldA contains a date, 12/11/2016, then entering (tabbing) into an empty FieldB will populate it with 16/ and place the cursor placed after the slash.

                    • 7. Re: Prevent repeated typing
                      RogerBirch

                      Hi David, thanks for suggestion. I have wriiten the script as you suggest (I think!!) :-

                       

                      IsEmpty ( Contacts::testfield ) ;Right ( Year ( Contacts::Arrival Date); 2 ) & "/" ;(Contacts::testfield)

                       

                      But when trying to OK it, I get a message saying that an operator is wanted here and refers to this part:-

                       

                      ;Right ( Year ( Contacts::Arrival Date); 2 ) & "/" ;(Contacts::testfield)

                       

                      Any thoughts please.

                      • 8. Re: Prevent repeated typing
                        andypieman

                        Not really read much of the rest of the post, but that last statement will fire the error you mention due to the fact its not encased in an If statement. If ( IsEmpty ( Contacts::testfield ) ;Right ( Year ( Contacts::Arrival Date); 2 ) & "/" ;(Contacts::testified) )

                        • 9. Re: Prevent repeated typing
                          David Moyer

                          what Andy said.

                          Plus, just in case, you should probably be using the Set Field script step, setting the field Contacts::testField.

                          • 10. Re: Prevent repeated typing
                            keywords

                            From what you originally proposed as your problem, I don't think a script is needed at all. It seems to me you want to be able to manually enter text in the field, but just want to auto enter the first part, which is common to all. Logically, therefore, an auto enter calc along the lines suggested by Erolst with the "Do not replace existing" option checked will see the common text entered as soon as the record is created. Set the field to not select all text on entry, so that when you tab or click into the field you cursor will go to the end of what's already there ready for you to type away.

                            • 11. Re: Prevent repeated typing
                              RogerBirch

                              Thank you all for your responses and support.