< Back

Document Subject: CheckBox Conundrum
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#Checkbox or http://A555F9/nn.nsf/ByAlias/Checkbox

Empty or no caption Checkboxes are a bit weird and tricky to do in notes domino for the web browser. Anyway I had a requirement for one of my pet projects - an anti-spam or Spamocider program (no one has used this word before according to Google so I claim it now 19 Oct 2006). Spamocider is like a genocider but kills spam. So back to the problem, I wanted a few checkboxes in my Spamocider, these were created in a webqueryopen agent, and then displayed in a web form and then the user could change them and then they were processed in a web query save agent. Easy you might say...




My checkboxes are displayed next to each message.

If I have identified the message as spam then I tick the checkbox, and highlight the row in red.

The user can override this tick by unticking it, to keep the message or tick the contact check box to say that it is from a contact and don't spam check messages from that address again.

 

The problem was how do i store that in the WQO agent, allow the user to change it and then capture it in the WQS agent?

 

Solution:

In the WQO store a tick as "YES", and an untick as " " - a space - needs to be a space ok?

So if spam message 1 is spam then:

Call con.ReplaceItemValue("cbcon_" & count, " ")
Call con.ReplaceItemValue("cbspam_" & count, "YES")

where con is documentcontext, cbcon_1 is checkbox for message 1 create contact, and cbspam_1 is checkbox for "this is spam".

NB You do not have do a call con.save in a WQO...

In the form:

cbcon_1 and cbspam_1 are editable checkboxes with "use formula for choices" picked and the formula is " |YES" . ie "space then pipe then YES" ok?

default value is empty, form does not inherit values from parent document...

In the WQS agent a the variables cbcon_1="YES" means it is ticked, cbcom_1="" means it isn't.

That might seem straightforward but it was a pain working it out and I needed to write it down for further reference and preservation of sanity...