• Selecting text in a form field – peculiar behavior (WORD 2002 (XP))

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Selecting text in a form field – peculiar behavior (WORD 2002 (XP))

    Author
    Topic
    #425611

    I have a WORD table with text form fields defined inside some of the cells. When I key text into a field, then use the mouse (or arrow keys) to highlight/select a portion of the text to edit it, the entire field starting at the position of the cursor to the end of the field is highlighted. For example, if the text I enter is “Fourscore and seven years ago” and I click the mouse with cursor positioned on the “s” in “seven”, all of the text “seven years ago” is selected. I can’t find any table property or other setting that might be related to this behavior.

    Viewing 1 reply thread
    Author
    Replies
    • #981032

      With respect to the mouse, that’s how Word works, when the form isn’t protected. Once the document is protected for forms, it will work the way you expect. To select only a few characters within the form field, you can either use the arrow keys or you can click inside the field, release, click again, & hold the mouse motionless for a couple of seconds (you’ll see a vertical hashed line), & then release again. However, you should be able to move the cursor within the field by using the arrow keys. If you use the shift key in conjunction with the arrow key, you can select portions of the field, EXCEPT when you get to either end. Then using the shift + arrow key selects the whole field.

      That last bit of behavior can be changed by going to Tools/Options/Compatibility tab & UNchecking “Select entire field with first or last character”.
      Hope this helps,

      • #981275

        I know how to select with the mouse and with the arrow keys. smile And they work fine when the data is in a form field, as long as it’s not in a table cell. In a form field inside a table cell, the mouse and arrow keys don’t behave as they normally do. Thanks for the suggestion about the Option setting, but it does not change this behavior.

        • #981292

          I see what you mean. I hadn’t tested it in a table cell. I’ll see if I can find anything & get back.

    • #981038

      I get the same behaviour you describe in Word 2003. It appears to work correctly when the form fields are outside of a table but the form fields inside table cells don’t want to play the game.

      The only thing I can suggest is to either not use table cells in your form layout or use different methods to edit form fields eg Ctrl-Delete to remove words one at a time

      • #981276

        I had already done as you suggested — not using tables in some parts of the form. However, a few remain that I’d like to leave that way.

        I think, when the document is unprotected, even inside a table cell, selection works the way it does everywhere else. Would it be feasible to insert code that would run when one of these fields is entered — unprotecting the document — and then code that would run when the field is exited — protecting the document again. I don’t know VBA well at all. Is the protection setting something that can be toggled in VBA code? Do I risk leaving the document unprotected in unusual situations, for example if the user enters one of those fields and never exits — just does a SAVE and CLOSE? Is there a foolproof way to intercept SAVE and CLOSE and make sure the document is protected at that point?

        • #981297

          Macros can run to protect the file at anytime but there are always going to be situations where an AutoOpen or AutoClose macro is circumvented eg by disabling macros or not having the template where the macros reside attached.

          VBA can easily protect and unprotect the form so that is not going to be an issue but once you have unprotected it the text within form field itself won’t be easily editable – and depending on your version of Word reprotecting the form will wipe the form fields unless you capture this action and handle it with VBA.

          Another possibility is that you use sections in the document and protect some sections but leave the tables where you want data entered in unprotected sections. It depends on how much you trust your users and how much they value selecting chunks in form fields.

          FWIW, typically Word’s form fields are used for data entry once and not re-edited numerous times so not many people would encounter this problem. If your document needs regular edits then perhaps that kind of user familiarity allows you to avoid form fields completely.

          • #981384

            You make a number of interesting points; however, I should have explained a bit more about the form usage. It is an application form that the user would almost never fill out more than once. So my concern over editing is simply a matter of helping the user make corrections to stuff like the spelling of their name and address. I may be making too much of an issue of this, but in working with the form in the role of “user”, I have found it annoying to have to go back and, for example, re-type most of my name when I miskeyed part of it (yes, I do occasionally mistype my own name.)
            compute

            I tried using code to unprotect at run-on-entry time and protect at run-on-exit time for a couple of the shorter fields (name, address). As you suggest, that seems to introduce another set of complications. I think that, for the shorter input fields, I’m just going to have to live with this anomaly regarding editing, unless someone else has another suggestion.

            For the longer, narrative fields, I’ve simply put the user-input areas (text form-fields) outside of tables. The only downside to that — and I’m not sure it’s all that much of a downside — is that I can’t make that part of the form look like fill-in-the-blanks, and I can’t limit the amount of text the user can type.

            Thanks for your help. I’ve posted another topic asking for suggestions of a useful text for form-fields, forms, and related VBA topics. If you are so inclined, please reply to that post as well.

            Phil

    Viewing 1 reply thread
    Reply To: Selecting text in a form field – peculiar behavior (WORD 2002 (XP))

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: