Domino 4.x/JavaScript Quick Reference

This table summarizes techniques specific to Domino, with and without JavaScript (JavaScript techniques are in blue). Note that JavaScript has nothing to do with Java, but rather it's an in-line scripting extension to HTML supported by Netscape 2.0+ and MSIE 3.0+

Domino/JavaScript Quick Reference

(replace any { with [ to use these Code Examples -- they had to be converted to prevent conflict when publishing this doc.)

Execution
Where/
When Exec'd?
Function
    Point of Implementation
    Where do you design it it Notes?
    Code Examples & Comments
    Useful with (or specific to) Domino deployment
Front End
Web Browser
Immediate
Editable field size
    Field Help Definition
    {<size=5 maxlength=5>]
Save Doc (Submit)
    First Button on form
    All code is ignored, but Title and placement apply
Hide Submit button
    First Button on form
    {<!-- -->] "comments out" the button
Delete Current Doc
    Hotspot, Action Button
    @Command([EditClear])
Edit Current Doc
    Hotspot, Action Button
    @Command([EditDocument])
Edit Any Doc
    Hotspot, Action Button
    **@URLOpen("NotesURLSyntax")
Open Any Doc
    Hotspot, Actn Bttn/RichTxt
    **@URLOpen("NotesURLSyntax") / DocLink
Run Agent
    Hotspot, Action Button
    @URLOpen("NotesURLSyntax")
*Subroutine

*Field Assignment
    Form Text, CompForDisp

    In any JavaScript
    {<Script language="JavaScript">
    function Calc(form) {
    form.Total.value = form.Qty.value*form.Price.value;
    }...</Script>]
    Note: use Shift+Enter for line breaks in code
*Field Event Handling
    Field Help Definition
    {<onFocus="Script;" onBlur="Script;" onChange=...>]
*Form Event Handling
    Form Text, CompForDisp
    [...<Body onLoad="Script;" onUnload="Script;">...]
*Background color change
    Form Text, CompForDisp
    [...<input type="button" value="Change to Gray" onClick= "document.bgColor='silver'">...]
*Hidden Editable Field
    Field Help Definition
    {<type="Hidden">] must NOT be hidden on Notes form
*Pop-up Validation
    Form Text, CompForDisp
    [...<input type="Button" value="Save" onClick="if(condition) alert('text') else form.submit();">...]
*General Button to call a JS Subroutine
    Form text, CompForDisp
    [...<input type="button" value="Recalc" onClick="Calc(form); or any function scripted elsewhere on form">...]
*Editable Dynamic Table Rows (also much faster to load for big tables)
    CompForDisp Field generates dynamic HTML for table, incl. fields
    JavaScript writes back data from temp table fields thru hidden editable multivalue fields to Notes doc. Dummy fields w/ same name as temp table fields must exist on Notes form.
Client<->Server Transaction
Domino DLL
Upon Opening or
submiting a page
Field Assignment
    Computed Field Formula
    @SetField("AnyFieldName"; value)
Input Validation (mes- sage on new page)
    Field Input Validation Formula
    @Failure("[URL or HTML]" or "text")
Save Event w/custom message or URL
    Computed Field named $$Return
Read-only Dynamic Table Rows
    Computed for Display field
    Use list @Functions to generate the HTML, pulling data from respective multivalue Notes fields.
Differentiate between Notes and Web clients
    Formulas: Hide When, Form Formulas (in a View), Computed Subforms.
    @IsMember("$$WebClient"; @UserRoles) Returns True for Web users, False for Notes users. Must have Enable
Input Translation
    Input Translation Formula
    Any valid input translation formula
* Enabled via JavaScript (supported by Netscape 2.01+ as of 11/12/96)
** Technique still works, but can be done more easily with Domino 1.5/Notes 4.5+