Solved

Change color of button on click in InfoPath 2010

Posted on 2012-04-05
4
2,065 Views
Last Modified: 2012-04-07
I have a button in a cell of a repeating table in InfoPath 2010 that I want to change to a color once clicked and to another color if double clicked for each row of the table. A rule using formatting doesn't seem to accomplish this and I am unsure how to do this in VSTA since something like e.source.backcolor = RGB(255, 0, 0)  isn't the correct way to do this.  Please help. Thanks.
0
Comment
Question by:RussRams
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 28

Expert Comment

by:clayfox
ID: 37817016
You can accomplish this logic with rules and actions.

You need a field to track state, one clisk or two. If the other actions chnages a field conclusivly you could use that otherwise make a field to track it.
0 = default, not clicked
1 = clicked once
2 = clicked twice

Then put conditional formating that if state is 1 one color or = 2 another color.

If this is a browser based form this can sometimes be more difficult since you may have postbacks and refreshs to check this and make the update happen.
0
 
LVL 28

Expert Comment

by:clayfox
ID: 37817025
Also if this is a repeating table, you may need the current() function to get just the row you want or you could enter the row ID into your state field and then look for where rowID = button state type of thing.

www.infopathdev.com is a good resource for this type of thing.
0
 

Author Comment

by:RussRams
ID: 37818374
Thanks clayfox. I understand what you are saying but since a button isn't a field in InfoPath 2010, what field type would you suggest?  I have tried making the cell a textbox field, but it seems you can't place a button within a textbox.  Should I create another column within  the row of the repeating table and place a button there (another column in the row or table) to change the shading color of the textbox to indicate a status.  My goal is for a supervisor to indicate to the user or the person filling out the form that an issue is to be put on hold = red or proceed = green or default = gray.  Default means the task was entered in the table by the assignee but the status is not yet been reviewed by the supervisor.  Does this make sense?  How do I get or indicate the row ID in the VB code?  I have pretty good .NET programming experience but InfoPath VSTA 2010 is relatively new to me.  The rules for state so far have alluded me in VSTA in InfoPath.
0
 
LVL 28

Accepted Solution

by:
clayfox earned 275 total points
ID: 37819051
You are probably making this more complicated than it need to be.  I assume that each row has a status field which would contain the "hold" , "proceed" or whatever.  
If you select the repeating table control and go to rules add a new formting rule.  If status equal "hold" then set to red.  This would make each row that had status "hold" equal to red.  You need to just play around a lot at first.

you can also do conditional formatting on a single field as well, or on a button, whichever you think is appropriate.

I would create a simple test form, witha  repeating list and play around with conditional formatting.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
Before you can digitally sign infopath forms, you must have a digital certificate. Microsoft Certificate Services will need to be enabled on a Windows Server 2008 to facilitate the creation and verification of the digital certifciates on the web ser…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question