Force max level to be >= min level.

This commit is contained in:
Greg Edwards 2015-05-09 17:30:12 -04:00
parent bf5c3a85bf
commit aebe8ee6ee
2 changed files with 36 additions and 2 deletions

View File

@ -16,9 +16,40 @@
<script type="text/javascript">
$(document).ready(function ()
{
$("#<%= txtLevelMin.ClientID %>").spinner();
$("#<%= txtLevelMax.ClientID %>").spinner();
betterSpinner($("#<%= txtLevelMin.ClientID %>"));
betterSpinner($("#<%= txtLevelMax.ClientID %>"));
});
function betterSpinner(input)
{
input.spinner(
{
spin: function(event, ui)
{
input.val(ui.value);
input.change();
}
});
}
function changedMax(idMin, idMax)
{
var minValue = parseInt($("#" + idMin).val(), 10);
var maxValue = parseInt($("#" + idMax).val(), 10);
if (minValue > maxValue)
$("#" + idMin).val(maxValue);
}
function changedMin(idMin, idMax)
{
var minValue = parseInt($("#" + idMin).val(), 10);
var maxValue = parseInt($("#" + idMax).val(), 10);
if (minValue > maxValue)
$("#" + idMax).val(minValue);
}
</script>
<form id="theForm" runat="server">

View File

@ -37,6 +37,9 @@ namespace PkmnFoundations.GTS
rptPokemon.DataSource = records5;
rptPokemon.DataBind();
}
txtLevelMin.Attributes["onchange"] = "changedMin(\'" + txtLevelMin.ClientID + "\', \'" + txtLevelMax.ClientID + "\');";
txtLevelMax.Attributes["onchange"] = "changedMax(\'" + txtLevelMin.ClientID + "\', \'" + txtLevelMax.ClientID + "\');";
}
private String FormatLevels(byte min, byte max)