Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2211
  • Last Modified:

Change color of button on click in InfoPath 2010

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
RussRams
Asked:
RussRams
  • 3
1 Solution
 
clayfoxCommented:
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
 
clayfoxCommented:
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
 
RussRamsAuthor Commented:
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
 
clayfoxCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now