Set Attribute - InfoPath Dev
in

InfoPath Dev

Set Attribute

Last post 11-14-2006 09:35 AM by Shiva. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-13-2006 10:00 AM

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

    Set Attribute

    Hello,

    I am attempting to change the font color of a text box using the following code in the OnValidate event:

    thisXDocument.DOM.documentElement.setAttribute("Font Color", "#ff0000")

    It does nothing: Can anyone see what is wrong. I am thinking that I may have the wrong attribute name.

    Any help would be appreciated.

    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:48 AM In reply to

    Hi Bill,

    To change the font color of a text box you need to use conditional formatting. Double-click the textbox control, go to Display, and then click on Conditional Formatting. You will want to change the text color to red on a specific event. You can setup a node in a secondary DOM to control the color of the text box and then in your OnValidate event you can change the value of the secondary DOM node.

    There are several posts in the forum regarding this, so if you get stuck give our little search feature a try!

    Hope this helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 11-14-2006 09:35 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694
    Hi Bill,

    We do not have an option like setAttribute method for setting the font color. Color is the property of font, div, span, paragraph, table and etc node types. This property is related to HTML or XSLT. These types of properties we have to change from InfoPath only as of Matt Faus explanation about changing the font color. Through the code we are not able to change the node color.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.