spiegel-keyman/web/docs/engine/guide/examples/__control-by-control.html
2026-06-09 18:07:07 +02:00

47 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src='https://s.keyman.com/kmw/engine/17.0.331/keymanweb.js'></script>
<script src='https://s.keyman.com/kmw/engine/17.0.331/kmwuitoggle.js'></script>
<script type='text/javascript' src='js/unified_loader.js'></script>
<script type="text/javascript">
keyman.init({
root: './', // Note - if drawing the latest version of KeymanWeb from the CDN, this will
// default to the source folder on our servers.
ui: 'toggle',
resources: './'
}).then(async function() {
// Load the keyboards of your choice here.
await loadKeyboards();
// Disable KeymanWeb interaction on the 'Email to' TEXT control
keyman.disableControl(document.f.address);
// Set the default keyboard for the 'Subject' TEXT control to 'off' (i.e.
// default browser keyboard). As KeymanWeb relies on the on-screen keyboard
// to change languages for touch-based devices, this will not work for them
// and will default to the first language added to KeymanWeb after
// initialization.
keyman.setKeyboardForControl(document.f.subject, '', '');
// Set the default keyboard for the 'Message body' TEXTAREA to the LaoKeys keyboard
keyman.setKeyboardForControl(document.f.text, 'Keyboard_laokeys', 'lo');
});
</script>
</head>
<body>
<h1>Control-by-Control Example</h1>
<form name='f' action='.' method='post'>
<p>Email to <span class='note'>(KeymanWeb not enabled)</span><br /><input type='text' name='address' size="40" placeholder="id = address"/></p>
<p>Subject <span class='note'>(Defaults to '(System keyboard)' or 'off' unless on a touch-based device)</span><br /><input type='text' name='subject' size="40" placeholder="id = subject"/></p>
<p>Message body <span class='note'>(Defaults to 'LaoKeys')</span><br /><textarea name='text' cols='40' rows='10' placeholder="id = text"></textarea></p>
</form>
<a href="control-by-control">Back to Document</a>
</body>
</html>