-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18 move between fields in form on return key (#35)
* wip: return moves to next element in form * wip: move js to bottom and wrap * wip: add document ready string * wip: adding js script for functionality * wip: fix next field logic * chore: cleaning changes * feat: add auto focus to checkout page * chore: delete personal testing files
- Loading branch information
Showing
3 changed files
with
54 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,54 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<h1>{% block title %} Checkout Asset {% endblock %}</h1> | ||
<form method="POST"> | ||
<label for="title">ID</label> | ||
<br> | ||
<input type="text" name="id" | ||
placeholder="Asset ID" | ||
value="{{ request.form['id'] }}"></input> | ||
<br> | ||
<label for="title">Accessory</label> | ||
<br> | ||
<input type="text" name="accessoryid" | ||
placeholder="Accessory ID" | ||
value="{{ request.form['accessoryid'] }}"></input> | ||
<br> | ||
<label for="type">Staff ID</label> | ||
<br> | ||
<input type="text" name="staffid" | ||
placeholder="Staff ID" | ||
value=""{{ request.form[staffid]}}></input> | ||
<br> | ||
<button type="submit">Checkout</button> | ||
</form> | ||
{% block head %} | ||
<script type="text/javascript"> | ||
|
||
// Focus on Staff ID on load | ||
function FocusOnLoad() { | ||
document.getElementById("staffid").focus(); | ||
} | ||
|
||
// Focus on Radio ID on [enter] | ||
function runScript(e) { | ||
if (e.keyCode == 13) { | ||
document.getElementById("radio").focus(); | ||
return false; | ||
} | ||
} | ||
|
||
// Focus on Headset ID on [enter] | ||
function runScript1(e) { | ||
if (e.keyCode == 13) { | ||
document.getElementById("accessory").focus(); | ||
return false; | ||
} | ||
} | ||
theform.setAttribute("autocomplete", "off"); | ||
</script> | ||
|
||
{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<h1>{% block title %} Checkout Asset {% endblock %}</h1> | ||
<form method="POST" id='theform' , class="a-form"> | ||
<label for="type">Staff ID</label> | ||
<br> | ||
<input type="text" id="staffid" name="staffid" placeholder="Staff ID" value="{{ request.form[staffid]}}" autocomplete="off" | ||
onkeypress="return runScript(event);"></input> | ||
<br> | ||
|
||
<label for="title">Asset ID</label> | ||
<br> | ||
<input type="text" id="radio" name="id" placeholder="Asset ID" value="{{ request.form['id'] }}" autocomplete="off" | ||
onkeypress="return runScript1(event);"></input> | ||
<br> | ||
|
||
<label for="title">Accessory</label> | ||
<br> | ||
<input type="text" id="accessory" name="accessoryid" placeholder="Accessory ID" | ||
value="{{ request.form['accessoryid'] }}" autocomplete="off"></input> | ||
<br> | ||
<button type="submit">Checkout</button> | ||
</form> | ||
{% endblock %} |