Solved

Change color of button on click in InfoPath 2010

Posted on 2012-04-05
4
1,942 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Last week I faced a strange issue recently, i have deployed SharePoint 2003 servers for one project and one of the requirements was to open SharePoint site from same server. when i was trying to open site from the same server i was getting authentic…
The Scenario: Let’s say you have a quote worksheet in Excel that you use to work up sales figures and such for your clients. You utilize SharePoint to manage and keep track of these documents. You would like values from your worksheet to populate Sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

860 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