spiegel-keyman/web/docs/engine/guide/examples/__control-by-control.html
Eberhard Beilharz 9ced04684a
chore(web): improve the KeymanWeb integration documentation
- replace use of `kmw` with `keyman`
- unify pattern to load keyboards: do it in `keyman.init().then()` instead
  of in the document `onload`

Part-of: keymanapp/keyman.com#449
Test-bot: skip
2026-06-03 19:37:08 +02:00

45 lines
No EOL
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src='https://s.keyman.com/kmw/engine/17.0.331/keymanweb.js'></script>
<script>var kmw = keyman;</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)
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 'English' 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>