Got ctrl+enter to submit a word from the Word Form. Just need to resolve some focus issues after editing.
This commit is contained in:
parent
20899eaa80
commit
06f5fe58c4
|
@ -60,19 +60,19 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php');
|
||||||
<form id="wordEntryForm">
|
<form id="wordEntryForm">
|
||||||
<div id="formLockButton" class="clickable" onclick="ToggleWordFormLock()" title="Lock/unlock form from the top of the page">🔒</div>
|
<div id="formLockButton" class="clickable" onclick="ToggleWordFormLock()" title="Lock/unlock form from the top of the page">🔒</div>
|
||||||
<label><span>Word</span>
|
<label><span>Word</span>
|
||||||
<input type="text" id="word" />
|
<input type="text" id="word" onkeydown="SubmitWordOnCtrlEnter(this)" />
|
||||||
</label>
|
</label>
|
||||||
<label><span>Pronunciation <a class="helperlink" href="/ipa_character_picker/" target="_blank" title="IPA Character Picker backed up from http://r12a.github.io/pickers/ipa/">IPA Characters</a></span>
|
<label><span>Pronunciation <a class="helperlink" href="/ipa_character_picker/" target="_blank" title="IPA Character Picker backed up from http://r12a.github.io/pickers/ipa/">IPA Characters</a></span>
|
||||||
<input type="text" id="pronunciation" />
|
<input type="text" id="pronunciation" onkeydown="SubmitWordOnCtrlEnter(this)" />
|
||||||
</label>
|
</label>
|
||||||
<label><span>Part of Speech</span>
|
<label><span>Part of Speech</span>
|
||||||
<select id="partOfSpeech"></select>
|
<select id="partOfSpeech"></select>
|
||||||
</label>
|
</label>
|
||||||
<label><span>Equivalent Word(s)</span>
|
<label><span>Equivalent Word(s)</span>
|
||||||
<input type="text" id="simpleDefinition" />
|
<input type="text" id="simpleDefinition" onkeydown="SubmitWordOnCtrlEnter(this)" />
|
||||||
</label>
|
</label>
|
||||||
<label><span>Explanation/Long Definition <span id="showFullScreenTextbox" class="clickable" onclick="ShowFullScreenTextbox('longDefinition', 'Explanation/Long Definition')">Maximize</span></span>
|
<label><span>Explanation/Long Definition <span id="showFullScreenTextbox" class="clickable" onclick="ShowFullScreenTextbox('longDefinition', 'Explanation/Long Definition')">Maximize</span></span>
|
||||||
<textarea id="longDefinition"></textarea>
|
<textarea id="longDefinition" onkeydown="SubmitWordOnCtrlEnter(this)"></textarea>
|
||||||
</label>
|
</label>
|
||||||
<input type="hidden" id="editIndex" />
|
<input type="hidden" id="editIndex" />
|
||||||
<span id="errorMessage"></span>
|
<span id="errorMessage"></span>
|
||||||
|
|
12
js/ui.js
12
js/ui.js
|
@ -248,6 +248,18 @@ function CloseUpdateConflictArea(displayId) {
|
||||||
EnableForm();
|
EnableForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SubmitWordOnCtrlEnter(keypress) {
|
||||||
|
var keyCode = (event.which ? event.which : event.keyCode);
|
||||||
|
|
||||||
|
if (keyCode === 10 || (keyCode == 13 && event.ctrlKey)) { //Windows and Linux Chrome accept ctrl+enter as keyCode 10.
|
||||||
|
AddWord();
|
||||||
|
|
||||||
|
if (document.getElementById("newWordButtonArea").style.display == "none" && document.getElementById("editWordButtonArea").style.display == "none") {
|
||||||
|
document.getElementById("updateConfirmButton").focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function DisableForm() {
|
function DisableForm() {
|
||||||
document.getElementById("word").disabled = true;
|
document.getElementById("word").disabled = true;
|
||||||
document.getElementById("pronunciation").disabled = true;
|
document.getElementById("pronunciation").disabled = true;
|
||||||
|
|
Loading…
Reference in New Issue