Example: CAPTCHA - Security image generator
Domino Developer Instructions
1. Type a message at the bottom of the web form where you would like the security image to appear. i.e. "Are you a robot? (CAPTCHA): Enter image text or refresh page."
2. Create field txt_SubmitCodeImages with Type attributes: Text, Computed when Composed, Allow multiple values
Copy/Paste the formula code in attachment below as the field value. NOTE: The 2 variable values at the top of the formula code can be changed to specify the minimum and maximum images to display (supports 1 to 27 images).
Domino-CAPTCHA-Code1.txt.zip
3. Create a user input field named txt_SubmitCodeInput below the field in step 2 with Type attributes: Text, Editable
4. Create field txt_SubmitCodeRndNumList below field in step 3 with Type attributes: Number, Editable, Allow multiple values
Add the HTML Other tag as seen below in the HTML tab in the Field property box, but if your form has “Render pass through HTML…” enabled, then add code to the Help Description instead as seen below in brackets. Add Default Value: txt_SubmitCodeRndNumList
5. Create field txt_SubmitCodeAnswer adjacent to the field in step 4 with Type attributes: Number, Editable, Allow multiple values
Add the HTML Other tag as seen above in the HTML tab in the Field property box. Copy/Paste the formula code in attachment below as the field value.
Domino-CAPTCHA-Code2.txt.zip
6. Create or edit the reserved field $$Return at the bottom of the web form with Type attributes: Text, Computed for Display
Copy/Paste the formula code in the example below as the field value and modify the code as necessary. The boolean expression in green below determines if the web user typed the correct security image. If the boolean expresion is True, then the user typed the correct security image and the SaveOptions reserved field value must be assigned "1" as seen below in green.
REM {CAPTCHA code part 3: Prevent robots};
REM {Coded by Lance Zakin - www.notesmail.com};
WebDBName := @WebDBName;
n := 1; codeAnswer := "";
@While(n <= @Elements(txt_SubmitCodeAnswer);
codeAnswer := codeAnswer + @Char(txt_SubmitCodeAnswer[n]);
n := n + 1);
@If(@UpperCase(txt_SubmitCodeInput) = codeAnswer; ""; @Return("[/" + WebDBName + "/MyForm?OpenForm]"));
FIELD SaveOptions := "1";
"[/" + WebDBName + "/MyView?OpenView]"
7. Create the reserved field named SaveOptions adjacent to the field in step 6 with Type attributes: Text, Computed when Composed
Hide the field from web browsers, and add the following as the field value: "0"
|