Skip to content

Commit

Permalink
improve LDtrait bp window validation behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
kvnjng committed Apr 24, 2020
1 parent 920bcf6 commit b511206
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions LDlink/LDlink-4.1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -4235,14 +4235,12 @@ function validateLDtraitBasePairWindow() {
var currentValue = $(textarea).val();
var currentValueNoCommas = currentValue.replace(/\,/g, '');
var hasError = !currentValue.match(pattern) || (currentValueNoCommas < 0 || currentValueNoCommas > 1000000);
console.log('hasError', hasError);
$(textarea).toggleClass('error', hasError);
$(textarea).toggleClass('ok', !hasError);
if (hasError) {
$(textarea).attr('title', errorMsg);
return false;
} else {
// $(textarea).removeAttr('title');
return true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions LDlink/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1690,9 +1690,9 @@ <h2 class="text-center">LDtrait Tool<sup><a class="help-anchor-link glyphicon gl
</div>
<div style="clear:both;"></div>
<div class="input-group row" style="min-width: 200px;">
<label id="ldtrait-bp-window-label" for="ldtrait-bp-window" style="width: 10px">&plusmn;</label>
<input id="ldtrait-bp-window" value="500000" type="text" pattern="^(\d+|\d{1,3}(,\d{3})*)(\.\d+)?$"
style="width: 70px;" title="Value must be a number between 0 and 1,000,000" required/>
<label id="ldtrait-bp-window-label" for="ldtrait-bp-window" style="width: 5px">&plusmn;</label>
<input id="ldtrait-bp-window" value="500000" type="number" pattern="^(\d+|\d{1,3}(,\d{3})*)(\.\d+)?$"
min="0" max="1000000" style="width: 75px;" title="Value must be a number between 0 and 1,000,000" required/>
<span>base pair window</span>
</div>
<div style="clear:both;"></div>
Expand Down

0 comments on commit b511206

Please sign in to comment.