sc_event_hint('field_name', 'help message', maximum_width)

The sc_event_hint macro allows the developer to define a help text (tooltip) for fields containing links created from the onClick event.

The macro is not available for events created from action bar buttons.

Parameters

The macro has three parameters, two of which are mandatory (field_name and message) and one optional (maximum_width). The parameters must be separated by a comma (,).

Parameter Description Example
field_name

Mandatory parameter that receives the field name, as a string, where the help text (tooltip) will be displayed.

The field name must be enclosed in double or single quotes, containing only the field name. This parameter does not accept the use of variables.

// Example of parameter definition.
sc_event_hint('field_name', 'Click for more information', 100);
message

Mandatory parameter that receives the help text to be displayed when hovering over the link created in the Ajax event. The text will be displayed only in the field specified in the first parameter if an onClick event is configured.

The parameter can be defined using:

  • String (enclosed in double or single quotes)
  • PHP variable
  • Global variable
  • Lang
// Defining the text using a string.
sc_event_hint('field_name', 'Click for more information', 100);

// Defining the text using a PHP variable. sc_event_hint('field_name',
$var_php, 100);

// Defining the text using a global variable. sc_event_hint('field_name',
[var_global], 100);

// Defining the text using a Scriptcase lang. sc_event_hint('field_name',
{lang_name}, 100);
maximum_width

Optional parameter that defines the maximum width of the hint where the message will be displayed. When reaching the defined limit, the text will wrap to the next line.

The size is defined in pixels and should only contain numbers.

// Defining the text with a width limit.
sc_event_hint('field_name', 'Click for more information', 100);

Example of use

Example 1: Using a lang

sc_event_hint("customerid", {lang_name});

 

Example 2: Using a PHP variable.

$var_msg_help = "Field help message";

sc_event_hint("customerid", &var_msg_help );

 

Example 3: With validation

if ( {person_type} == "F" ) {
sc_event_hint(field,"Individual");
} else {
sc_event_hint(field,"Company");
}