Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    413
    Thanks
    3
    Thanked 1 Time in 1 Post

    Form fields in Word 2010, a puzzle

    I'm having my first encounter with forms in Word 2010, and I've run into a bit of behavior that I don't understand.

    My forms contain plain text fields that behave two different ways. Some behave like this:

    • If I click the field in the template, it selects the whole field.
    • If I click the field in a document based on the template and type, the instructions in the field are replaced by what I type.
    • The text I type assumes the font properties of the field, not the instructions. (For example, I can make the field's color automatic and make the instructions' color brown; the instructions appear in brown, making the empty field highly visible, but the text that the user types appears in black.)

    Some fields behave like this:

    • If I click the field in the template, it places the insertion point where I clicked in the instructions.
    • If I click the field in a document based on the template and type, the text I type is inserted into the instructions where I clicked.
    • The text I type assumes the font properties of the instructions, even I select the field itself, not the contents, before I type.

    I've compared the field properties of these two types of fields, and I don't see any difference. What causes it, and how can I control it?

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,508
    Thanks
    3
    Thanked 143 Times in 136 Posts
    I assume you are not using Content Controls vs Form Fields.

    I don't have an answer for you without seeing a document with the problem but perhaps there is a difference between form fields inserted by Word 2003, 2007 and 2010. Does the document say it is in 'Compatibility Mode'? If so, does saving to pure 2010 docx change anything?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #3
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    413
    Thanks
    3
    Thanked 1 Time in 1 Post
    The document is not in compatibility mode. It has been created and edited only with Word 2010 (in fact with a single copy of Word 2010).

    I'm attaching a simplified version of one of the form templates. Because of this site's file naming restrictions, you'll have to change the filetype from .docx to .dotx.

    The template contains four fields. If you click in the first (plain text) or the third (plain text), Word places the insert point where you clicked. If you click in the second (plain text) or the fourth (date), it selects the entire text.
    Attached Files Attached Files

  5. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,508
    Thanks
    3
    Thanked 143 Times in 136 Posts
    This has something to do with the ShowingPlaceholderText property of the Content Control. This property is read only in VBA so I don't see how you can change the setting but once you have changed the value of the range then this property appears to be changed permanently to False.
    If you step through this code you can play with the settings
    Code:
    Sub temp1()
      Dim aCC As ContentControl
      For Each aCC In ActiveDocument.ContentControls
        Debug.Print aCC.Tag & " : " & myNz(aCC.ShowingPlaceholderText) & " : " & aCC.Range
        aCC.SetPlaceholderText , , "Now I can see the placeholder text"
        aCC.Range.Text = "This is the CC value"     'this changes the .ShowingPlaceholderText value to false
      Next aCC
    End Sub
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #5
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    413
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thank you Andrew. That gives me some insight into the cause of the problem, but not into how to prevent or correct it!

    If you have any further insights, or anyone else does, please chime in.

  7. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 28 Times in 27 Posts
    How are you changing the default placeholder text, to begin with?

    Gary

  8. #7
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    413
    Thanks
    3
    Thanked 1 Time in 1 Post
    How?... the same way I change any other text: whatever way happened to be most convenient at the moment it needed doing. I really don't remember, any more than I remember how I sat down in my chair when I began working.

    If there are right and wrong ways to change the text, you'd best explain.

  9. #8
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 28 Times in 27 Posts
    Here's a revised version of your document (you'll need to change the file extension back to .dotx after downloading it). Let me know if that works now.

    Gary
    Attached Files Attached Files

  10. #9
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,508
    Thanks
    3
    Thanked 143 Times in 136 Posts
    Now that's intriguing Gary - have you been editing the xml directly or is there a way via VBA or the GUI to reset the placeholder?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  11. #10
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 28 Times in 27 Posts
    Hi Andrew,

    To be honest, when I asked the question a couple of posts above, I didn't know the answer either - just thought it might help the troubleshooting to find out how they were originally done. I've used built-in document property content controls before, that effectively change the placeholder text, but never done so with the regular type.

    Anyway, just from playing around in a blank document, it looks like if you click in the content control, then go into Design Mode and delete the contents so that it reverts to the default placeholder text, and then put in your custom placeholder text, and finally exit Design Mode, that allows you to set custom placeholder text.

    I couldn't get the above to work correctly on the first content control that was in the originally-posted document (figured maybe there was just something wrong with the XML), so in that document I just deleted the two misbehaving controls, added new ones, and did the steps above.

    And subsequent to doing the above, I just looked up the topic in Stephanie Krieger's Documents, Presentations, and Workbooks, and see there's a detailed writeup on customizing content controls there - that book, as well as her 2007 version, are fantastic resources.

    Gary

  12. #11
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    413
    Thanks
    3
    Thanked 1 Time in 1 Post
    I tried it again and found that if I move the insert point out of a newly created field before leaving developer mode, the field works correctly. Gary, I didn't completely follow the description of what you did, but I think this is it, or at least is equivalent to it.

    I don't understand what was going wrong or why this procedure avoids it, but in this case Monkey See, Monkey Do is good enough.

    Thanks for helping me figure it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •