Naming Conventions JavaScript functions

Attribute(s)

  • Naming Convention

    Description

    JavaScript functions: the naming convention for JS functions is described in the Details field.

    Motivation

    A recognizable and understandable function name results in that it's easier to find where the function is used and where called functions are stored.

    Example / Details

    JS functions will always start with a small character.

    The name of the function depends on the usage and the storage of the functions.
    We have 3 types of JS functions:
    Functions which represent event actions
    Functions which are general used in one form
    Functions in JS Script Libraries (subforms)

    Functions which represent event actions
    When a function is only called from one event the name of the function will
    have the following format:
    <Item name><element name><event name>
    e.g.
    firstNameFieldOnChange()
    addNameButtonClick()

    Functions that are general used in one form
    Functions, such as presentation functions, will be named in accordance with
    following format:
    form<Name>
    e.g.
    formShowLayer()

    Functions in JS Script Libraries (subforms)
    Functions stored in a JS Script Library will be named in accordance with
    following format:
    lib<Library Abbreviation><Name>

    Example:
    libVALValidate()