Skip to content

Commit

Permalink
Set focus to error fields
Browse files Browse the repository at this point in the history
  • Loading branch information
proginosko committed Dec 3, 2017
1 parent 4b305fe commit 14907f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@ function saveOptions() {
// Check field values
if (!checkTimePeriodsFormat(times)) {
$("#tabs").tabs("option", "active", (set - 1));
$(`#times${set}`).focus();
$("#alertBadTimes").dialog("open");
return;
}
if (!checkPosIntFormat(limitMins)) {
$("#tabs").tabs("option", "active", (set - 1));
$(`#limitMins${set}`).focus();
$("#alertBadTimeLimit").dialog("open");
return;
}
if (!delaySecs || !checkPosIntFormat(delaySecs)) {
$("#tabs").tabs("option", "active", (set - 1));
$(`#delaySecs${set}`).focus();
$("#alertBadSeconds").dialog("open");
return;
}
if (blockURL != DEFAULT_BLOCK_URL && blockURL != DELAYED_BLOCK_URL
&& !getParsedURL(blockURL).page) {
$("#tabs").tabs("option", "active", (set - 1));
$(`#blockURL${set}`).focus();
$("#alertBadBlockURL").dialog("open");
return;
}
Expand Down

0 comments on commit 14907f3

Please sign in to comment.