Solved

Change color of button on click in InfoPath 2010

Posted on 2012-04-05
4
2,032 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 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