Solved

Change color of button on click in InfoPath 2010

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

Join & Write a Comment

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now