Contact Information
- Email: ctoohey@dominoguru.com
- BleedYelow.com: Chris Toohey
- Skype: ChrisToohey
- Gizmo: ChrisToohey
- Yahoo!: ChrsToohey
- Google: ChristopherToohey
(ctoohey@dominoguru.com) - AIM: ChrisToohey
- Twitter: ChrisToohey
- Facebook: ChrisToohey
- LinkedIn: Chris Toohey
- Videos:vimeo.com/christoohey
- Podcast Information
http://www.yellowcast.net
YellowCast @ Twitter - RSS:

- Guru Tag:

Like what you see? Help feed-the-beast by donating to the site and it's humbly thankful author!
My Twitpic Updates
My Twitter Updates
Publishings
Domino Development and Data Store Architecture 06/06/2008Domino Development RIM's Blackberry Connections Client - First Impressions (Part 2) 05/19/2008
My Gear RIM's Blackberry Connections Client - First Impressions 05/19/2008
My Gear Remove my name from the Domino Directory!! 02/05/2008
Lotus Notes Quick and Dirty Mail Application Document Importing 01/24/2008
Methods and Strategies Publishings Archive
Examples & Downloads
Showtime: Blackberry Enterprise Server Push Utility for the Lotus Notes Client - Release v0.1 11/13/2008Examples and Downloads MixMaster v0.1 - Remote NotesItem Manager 10/06/2008
Examples and Downloads No-View NotesDocument Lookups, UNID Logic, and Environment Variables - Example Application and Video Tutorial 09/16/2008
Examples and Downloads xCopy v0.2 - OS xcopy Client for Lotus Notes 08/07/2008
Examples and Downloads xCopy - Local Archiving and File Copying Utility for Lotus Notes 07/22/2008
Examples and Downloads E & D Archive
Resources
PlanetLotus.org [ Community ] Alan Lepofsky's Notes Tips [ Community ] Chris' The Business Controls Caddy [ Community ] Petr Stanicek [pixy] [ CSS ] JoeLitton.net [ Community ] Resources ArchiveComputed Text, Select and Input Elements, and the home grown Domino Form
05/30/2007 07:49:05 AM | Chris Toohey | Saylorsburg, PA
As I had mentioned in my last post - using a FIELD element in your home grown Domino Forms markup to display a given fields content is a quick and easy way to get around the need for <Computed Text> elements - but that only really works for single valyue Input and Textarea elements on your form. You'll run into a problem quite frankly when you try to use any other element type that gathers input from a user, such as a Select or Input (checkbox or radio) elements.
To get around this, I typically do rely on the <Computed Text> elements, and storing all options for my fields in a "profile" document -
I say "profile" document, because it's not a LND-styled Profile Document, as I've found that HTTP Task caching can cause pains when you're storing things like keywords or other various content. I've even seen very old content magically re-appear in the Profile Document, which can be quite a problem. And I'm using a document and not storing these items as part of the design because I want to give Database Administrators et al the ability to maintain their own applications...
- So I'll store my keywords and other such content on a profile document that I'll call "preferences". Now, for my <Computed Text> element Formula. I'll show you that with the markup for a typical select field:
<select name="test" id="test">
<Computed Text>
</select>The <Computed Text> elements Formula:
key := "test";
val := @DBLookup("":"NoCache";"":"";"bykey";"preferences";key;[FailSilent]);
@For (
n := 1;
n <= @Elements(val);
n := n + 1;
@If(
@IsMember(val[n];test);
markup := markup : @Text("<option selected value=\"" + val[n] + "\">" + val[n] + "</option>");
markup := markup : @Text("<option value=\"" + val[n] + "\">" + val[n] + "</option>")
)
);
@Implode(markup)Now, this works for Select elements, but we also have Input (checkboxes and radiobuttons) to consider. Checkboxes and radiobuttons differ in that you can select multiple items with the checkboxes, while only a single option can be selected for the radio button (duh! - I know, but it warrants comment for what's coming up). So we'll need to modify our formula to accomodate their element-function requirements.
Checkboxes:
key := "test";
val := @DBLookup("":"NoCache";"":"";"bykey";"preferences";key;[FailSilent]);
@For (
n := 1;
n <= @Elements(val);
n := n + 1;
@If(
@IsMember(val[n];test);
markup := markup : @Text("<input type=\"checkbox\" name=\"test\" id=\"test_" + @Text(n) + "\" checked value=\"" + val[n] + "\" /><label for=\"test_" + @Text(n) + "\">" + val[n] + "</label><br />");
markup := markup : @Text("<input type=\"checkbox\" name=\"test\" id=\"test_" + @Text(n) + "\" value=\"" + val[n] + "\" /><label for=\"test_" + @Text(n) + "\">" + val[n] + "</label><br />");
)
);
@Implode(markup)And Radiobuttons:
key := "test";
val := @DBLookup("":"NoCache";"":"";"bykey";"preferences";key;[FailSilent]);
@For (
n := 1;
n <= @Elements(val);
n := n + 1;
@If(
@IsMember(val[n];test);
markup := markup : @Text("<input type=\"radio\" name=\"test\" id=\"test_" + @Text(n) + "\" checked value=\"" + val[n] + "\" /><label for=\"test_" + @Text(n) + "\">" + val[n] + "</label><br />");
markup := markup : @Text("<input type=\"radio\" name=\"test\" id=\"test_" + @Text(n) + "\" value=\"" + val[n] + "\" /><label for=\"test_" + @Text(n) + "\">" + val[n] + "</label><br />");
)
);
@Implode(markup)And that's pretty much it. Now, this code can be cleaned up, but I thought that I would keep it as easy to read is possible. Our next move, and hopefully something that I can get out there in the next few days, will be a downloadable example of a database that uses these approaches for it's hand made Domino Forms!
Like what you see? Help feed-the-beast by donating to the site and it's humbly thankful author!
Chris Toohey | Domino Guru

Comments
http://quintessens.wordpress.com
05/31/2007 04:45:18 AM
Thanks for the tip.
Nice and clear!
I have no problem using profile documents, but I agree when building and testing, the caching can be a pain in the ass.
10/24/2008 06:27:38 AM
I tumbled across this tip looking for a solution to the following problem:
I have a computed text that generates a html checkbox input - very similar to your code. Everything looks great when I open the form with the Notes client, but: I cannot use the mouse to activate the checkboxes. That only works using the SPACE key.
So I tried the same thing using your code and I experience exactly the same problem here. I am using Notes 8.01 Basic client, but Notes 7 behaves the same way.
Any idea?