UNB Components Code Reference

UnbUi::InsertDefaultMessage method

Prints JavaScript code to handle a default message for empty input fields and a dedicated hidden input field that tells the form handler to ignore the default message and that the input field is actually empty.

private static function UnbUi::InsertDefaultMessage ($id, $defaultMessage, $emptyFieldName = '');

Parameters

id

(string) HTML element ID of the input element to generate code for

defaultMessage

(string) Default message to show if the input element is left empty

emptyFieldName  –  optional, default: ''

(string) Form element name of the field to set when the default message has been put in the input element. Ignored if empty. Do not use any " (double quote) here, it will break the JS code.

Remarks

When the default message is set, the CSS class {{default-message}} is applied to the input element.

The JavaScript code generated here relies on dynamic-lib to be loaded.

See also

<http://unclassified.de/go/dynamic-lib>.

Member of class: UnbUi

Implementation file: ui.class.php, line 669

© 2011 Yves Goergen. UNB Components Homepage. Reference generated on 2011-02-06.