Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:49:12+00:00 2026-06-01T12:49:12+00:00

I’m currently trying to implement a simple Add-In for InfoPath 2010 Filler/Editor mode, which

  • 0

I’m currently trying to implement a simple Add-In for InfoPath 2010 Filler/Editor mode, which adds a few buttons on the “Insert” ribbon, which upon clicking inserts some “template” data from another source.

It works fine but the thing that’s annoying me is that when the user has no field selected, it remains enabled while all of the other buttons on the insert toolbar somehow “know” that nothing can be inserted in the current context and are therefore disabled.

The MSDN documentation on how to interact with the underlying XDocument is perfectly adequate, but what I’m struggling to figure out is how to interact or get information from the editing UI.

This is what I’d like to have:

  • An event that gets fired when the user changes from field to field on the form
  • Then be able to tell what kind of field the user is currently entering data into (i.e. rich text, plain text etc), so the extra buttons can be enabled or disabled as needed.

I thought this would be fairly simple but I’ve spent nearly a day looking through everything I can find, and have come up empty!

Or have I completely missed the point here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:49:14+00:00Added an answer on June 1, 2026 at 12:49 pm

    Several months later I can finally answer my own question. Not that anyone uses InfoPath filler, but just in case anyone does, here’s my solution:

    There’s several points to my original question.

    1) Event that gets fired when the user changes from field to field:

    This turns out to be specified in the Ribbon Button XML as the “getEnabled” attribute. InfoPath calls the specified function each time it thinks the button may need to be enabled or disabled. On mine I specified: getEnabled=”OnButtonGetEnabled”, then implemented a small function:

        public bool OnButtonGetEnabled(Office.IRibbonControl control)
        {
            ribbon.Invalidate();
            return HaveRichTextFieldSelected(GetContextXPath());
        }
    

    in my case ‘ribbon’ is my instance of Office.IRibbonUI. Calling ‘Invalidate()’ is pretty important otherwise InfoPath only ends up calling this once.

    2) How to determine the type of the field the user has selected.

    I’m still not happy with my solution for this but at least I now have something that works.

    I’ve written two functions:

    1: GetContextXPath() which calls Globals.ThisAddIn.Application.ActiveWindow.XDocument.View.GetContextNodes(), builds an XPath string from the result (walking backwards through the DOM tree)

    2: HaveRichTextFieldSelected() which checks if the specified XPath is of type ‘rich’ in the manifest (whose DOM tree is under Globals.ThisAddIn.Application.ActiveWindow.XDocument.Solution.DOM)

    Anyway I’m not posting all of the code involved here as it’s too much for an SO answer, but this should give someone with some common sense a clue as to how to implement this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.