Mobile GlideForm (g_form) - クライアント
Mobile GlideForm (g_form) メソッドを使用すると、モバイルプラットフォームでフォームを操作できます。
これらのメソッドは、モバイルデバイスをターゲットとするスクリプトで使用します。
MobileGlideForm (g_form) - addDecoration(文字列 fieldName, 文字列 icon, 文字列 text)
フィールドの横に装飾アイコンを追加します。
| 名前 | タイプ | 説明 |
|---|---|---|
| fieldName | 文字列 | フィールド名 |
| アイコン | 文字列 | フィールドの横に表示するフォントアイコン。 |
| テキスト | 文字列 | アイコンのテキストタイトル (スクリーンリーダーに使用)。 |
| タイプ | 説明 |
|---|---|
| なし |
この例では、問い合わせユーザーの横に VIP アイコンを追加します。
function onChange(control, oldValue, newValue, isLoading) {
// if the caller_id field is not present, then we can't add an icon anywhere
if (!g_form.hasField('caller_id'))
return;
if (!newValue)
return;
g_form.getReference('caller_id', function(ref) {
g_form.removeDecoration('caller_id', 'icon-star', 'VIP');
if (ref.getValue('vip') == 'true')
g_form.addDecoration('caller_id', 'icon-star', 'VIP');
});
}
MobileGlideForm (g_form) - getLabel(文字列 fieldName)
フォームラベルテキストを取得します。
| 名前 | タイプ | 説明 |
|---|---|---|
| fieldName | 文字列 | フィールド名 |
| タイプ | 説明 |
|---|---|
| 文字列 | ラベルテキスト。 |
if (g_user.hasRole('itil')) {
var oldLabel = g_form.getLabel('comments');
g_form.setLabel('comments', oldLabel + ' (Customer visible)');
}
MobileGlideForm (g_form) - hasField(文字列 fieldName)
フォームにフィールドが存在するかどうかを判断します。
「存在する」とは表示できることを意味し、表示されるという意味ではありません。
| 名前 | タイプ | 説明 |
|---|---|---|
| fieldName | 文字列 | 検索するフィールド。 |
| タイプ | 説明 |
|---|---|
| ブーリアン | フィールドがフォーム上に存在する場合は true、そうでない場合は false。「フォーム上」とはフィールドが g_form の一部であることを意味します。ただし、非表示、読み取り専用、必須、または無効である可能性があります。 |
この例では、[assignment_group] フィールドがフォーム上にある場合、[assigned_to] フィールドが必須になります。
if (g_form.hasField('assignment_group'))
g_form.setMandatory('assigned_to', true);
MobileGlideForm (g_form) - removeDecoration(文字列 fieldName, 文字列 icon, 文字列 text)
フィールドの横から装飾アイコンを削除します。
| 名前 | タイプ | 説明 |
|---|---|---|
| fieldName | 文字列 | フィールド名 |
| アイコン | 文字列 | 削除するアイコン。 |
| テキスト | 文字列 | アイコンのテキストタイトル。 |
| タイプ | 説明 |
|---|---|
| なし |
function onChange(control, oldValue, newValue, isLoading) {
// if the caller_id field is not present, then we can't add an icon anywhere
if (!g_form.hasField('caller_id'))
return;
if (!newValue)
return;
g_form.getReference('caller_id', function(ref) {
g_form.removeDecoration('caller_id', 'icon-star', 'VIP');
if (ref.getValue('vip') == 'true')
g_form.addDecoration('caller_id', 'icon-star', 'VIP');
});
}
MobileGlideForm (g_form) - setLabel(文字列 fieldName, 文字列 label)
フォームラベルテキストを設定します。
| 名前 | タイプ | 説明 |
|---|---|---|
| fieldName | 文字列 | フィールド名 |
| label | 文字列 | フィールドラベルテキスト。 |
| タイプ | 説明 |
|---|---|
| なし |
この例ではコメントラベルを変更します。
if (g_user.hasRole('itil')) {
var oldLabel = g_form.getLabel('comments');
g_form.setLabel('comments', oldLabel + ' (Customer visible)');
}