Font Color - InfoPath Dev
in

InfoPath Dev

Font Color

Last post 12-08-2006 12:09 PM by Javier007. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 11-07-2006 10:33 AM

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Font Color

    Hello,

    I am trying to identify when values have changed on a form by changing the font color when the data is updated or changed by the end user.

    For Example:

    I set x = 1. Two days later I change x = 2. Now when someone reviews the form, they can see at a quick glance what information has changed.

    Is this possible? If yes, how?

    Thank you in advance for your help!!!

    Bill
    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 11-07-2006 10:52 AM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283
    This will be possible through code obvisously, but what fields are you trying to change. Give us a better example.
  • 11-07-2006 11:00 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57
    I want to set font color on all text boxes on the main view. I have approixmatley 500 text boxes (yes..big form). Is there one command to execute this?

    Bill
    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 11-07-2006 11:53 AM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283
    Yes...you would have to write code in the event handler. All you have to do is right click on any text box and select properties and select data Validation then select an event....this will most likely be the before event an write some code...maybe like this...
    Use the javascript triggered by the onFocus and onBlur attributes within the textbox html. The javascript you need to use to actually change the color is something like this: Just do a little research and google it...hope this helps.

    //To set it
    textbox.style.backgroundColor = "#FF0000";

    //To "clear" it. If the BGcolor is set by some CSS style,
    //clearing it will make it revert back to the CSS defined appearance.
    textbox.style.backgroundColor = "";

    Take a look at the CSS reference at the MSDN site. This is one of the most complete CSS/DHTML references I have found:
    http://msdn.microsoft.com/library/default.asp?url=/workshop/author/css/reference/css_ref_entry.asp

  • 11-10-2006 07:59 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57
    Can this be completed generically from the On Context Change event? If so, do you have the actual syntax?

    For example: fieldname = thisXDocument.DOM.selectSingleNode("/dfs:myFields/my:ApplicationType")

    What would the syntax be for changing the color of this field from blue to red?

    Thanks!
    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 11-14-2006 07:52 AM In reply to

    I believe this is a duplicate of this post:http://infopathdev.com/forums/topic.asp?TOPIC_ID=3692

    Michael, I have never seen this method to change the font color of a textbox control in an InfoPath form - could you e-mail me an XSN where this technique is working?

    Bill, since you have so many fields you might want to use a whole other view to show all the fields as red if you don't want to make all the secondary DOM nodes. See the other post for more information on this.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 11-14-2006 08:07 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57
    Matt,

    Thanks for the reply. My first solution was two different views, one in red and one in blue. However, my manager wants the text to remain blue unless it is edited. So this also rules having different style sheets as well.

    I thought I had the write code statement but I am now wondering if it does not understand or know what element to apply the formating to. I will review the attached information but if you get a XSN file from Michael, please forward it on to me.

    Thanks!

    Bill
    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 12-07-2006 08:26 AM In reply to

    Hey Bill,

    Here's an idea:

    1. Create a boolean node in a secondary dom called "fieldXedited" - defaults to false
    2. Set conditional formatting on fieldX in the Main DOM to be blue/red depending on value of "fieldXedited" on 2DS
    3. Add an OnAfterChange event on fieldX that sets "fieldXedited" to true.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-08-2006 12:09 PM In reply to

    This is in reply to Matt's last reply. I'm trying to follow your explanation below and am a little lost. Can you explain it on a more basic new user level please. I'm a newbie when it comes to nodes and doms.

    Thanks,

    Javier
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.