Solved

Checkbox to display image

Posted on 2011-09-23
8
508 Views
Last Modified: 2013-12-18
I have a contact app I need to make and wanted to be able to select the "prefered method" of contact for a person. For example, I have fields for work phone, cell phone, home phone, alternate phone. I wanted the admin assistant to check a box for the "prefered" contact and then display a gold star image by that phone number.  I did not want to display a value for the checkbox, just that if it is checked, then display star, if not, display nothing.

I am finding that when I create a checkbox with no value, when I go to check the box, the checkmark disappears after I exit the field.

Is there a way to set the checkbox to no value and just display a box to check?
Checkbox-Question.gif
0
Comment
Question by:kali958
[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
  • 3
  • 2
8 Comments
 
LVL 10

Assisted Solution

by:doninja
doninja earned 200 total points
ID: 36587302
You can't make the check box have no value but what you can do is set it to something like . (Dot) and then make the text colour of the box the same as the background colour.

The check box itself will keep default system colours only the text will disspapear. You then have a value to test for in hide formulas etc
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 36587553
That is a good workaround.

Another option is to use no choices for the checkbox, but code an onChange event handler that maintains the actual fields that control whether the image is displayed.  If you code onChange, make sure you also enable the field's 'Run Exiting/OnChange events after value change'.
0
 

Author Comment

by:kali958
ID: 36587618
@doninja - that is a "workaround" but when I put in a "dot" or the letter "y" and make the text white, it throws off the alignment of the field and then also shows a box after the checkmark. (See Image).

@Bill - I am willing to try the OnChange, but I am assuming I would have to LotusScript that. So write something that would say "If this box is clicked/checked, then display the gold star, if not, do not display image?"
Would this still retain the checkmark in the checkbox field?
 Example of how it displays per first suggestion
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 10

Expert Comment

by:doninja
ID: 36587724
do get a slight box when selecting the box and the alignment can be cured with div or put the box and image in their own table cells.

Bill's solution is a good coded solution rather than my simple workround.

Most people don't even notice the slight box on the page's I have done as they are clicking through it. This can work for users using web browser access as well with no major changes.
0
 

Author Comment

by:kali958
ID: 36587754
@doninja - what do you mean by "cured with div" (I get what you mean about cells)
 This is also only for client users, company does not use web :(
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 36588069
RE: So write something that would say "If this box is clicked/checked, then display the gold star, if not, do not display image?"

Notes forms don't work like that.  Instead, you would have a hidden field for each image.  The fields would initially be blank.  When the user clicks on a checkbox, the code would loop through the hidden fields, setting all to blank except the one that controls the image for that field, which would be set to "1".  Then, the hide-when formula behind the image would simply check the controlling hidden field for the value "1".

RE: Would this still retain the checkmark in the checkbox field?

No
0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 300 total points
ID: 36588205
Here's the basic idea behind the coding.  You would need to parameterize this and make the hidden field names fit your specific need.  For example, this code uses a set of hidden fields named 'hiddenField1', 'hiddenField2', 'hiddenField3', etc, but you can use any names you want.  Also, this code is hard coded to always set 'hiddenField1', so you will need to add you own parameters.
Sub Onchange(Source As Field)
	Dim ws As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim doc As NotesDocument
	Dim index As Integer
	Set uidoc = ws.CurrentDocument
	Set doc = uidoc.Document
	For index = 1 To 10
		If (index = 1) Then
			doc.ReplaceItemValue "hiddenField" + Cstr(index), "1"
		Else
			doc.ReplaceItemValue "hiddenField" + Cstr(index), ""
		End If
	Next
	uidoc.Refresh
End Sub

Open in new window

0
 

Author Closing Comment

by:kali958
ID: 36598822
Both will work. I am going to try the coded solution but I am running out of time on this project so may need to go to the first solution.

Thank you both for taking the time to help me understand the solution.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
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: …

634 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