Skip to content

Commit

Permalink
Form validation happens on submit
Browse files Browse the repository at this point in the history
fixes #52
  • Loading branch information
p-sam committed Jan 14, 2020
1 parent 9f2a978 commit efb3cba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/page/prompt.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ select#data {
padding: 0 .5em 0 0;
}

#buttons > button {
#buttons > button,
#buttons > input[type=submit] {
border-radius: 2px;
border: 0;
margin: 0 0 0 .5em;
Expand Down
6 changes: 3 additions & 3 deletions lib/page/prompt.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
</head>
<body>
<div id="container">
<div id="form">
<form id="form">
<div id="label">...</div>
<div id="data-container"></div>
<div id="buttons">
<button id="cancel">Cancel</button>
<button id="ok">OK</button>
<button type="submit" id="ok">OK</button>
</div>
</div>
</form>
</div>
<script src="prompt.js"></script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions lib/page/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ docReady(() => {
return promptError(error);
}

document.querySelector('#ok').addEventListener('click', () => promptSubmit());
document.querySelector('#cancel').addEventListener('click', () => promptCancel());
document.querySelector('#form').addEventListener('submit', promptSubmit);
document.querySelector('#cancel').addEventListener('click', promptCancel);

const dataContainerEl = document.querySelector('#data-container');

Expand Down

0 comments on commit efb3cba

Please sign in to comment.