W
Willem
I have got a very simple javascript which compares about 8 controls in
pairs of two. i.e. maxA - minA <= 25.
Now I would like it to be triggered for validation (before submit?) and
cancel the submit if neccessary. Very easy to do if it were plain HTML.
No idea how to implement this in ASP.NET 2 though. Can someone please
point me in the right direction?
the script:
function checkDifferences()
{
var msg;
if (txt_MinA.value != "" && txt_MaxA.value != "")
{
if (txt_MaxA.value - txt_MinA.value > 25)
{
msg = "A: The difference can't be over 25 mm.\n";
}
}
if (txt_MinB.value != "" && txt_MaxB.value != "")
{
if (txt_MaxB.value - txt_MinB.value > 25)
{
msg += "B: The difference can't be over 25 mm.\n";
}
}
if (txt_MinC.value != "" && txt_MaxC.value != "")
{
if (txt_MaxC.value - txt_MinC.value > 25)
{
msg += "C: The difference can't be over 25 mm.\n";
}
}
if (txt_MinD.value != "" && txt_MaxD.value != "")
{
if (txt_MaxD.value - txt_MinD.value > 25)
{
msg += "D: The difference can't be over 25 mm.\n";
}
}
return msg;
}
pairs of two. i.e. maxA - minA <= 25.
Now I would like it to be triggered for validation (before submit?) and
cancel the submit if neccessary. Very easy to do if it were plain HTML.
No idea how to implement this in ASP.NET 2 though. Can someone please
point me in the right direction?
the script:
function checkDifferences()
{
var msg;
if (txt_MinA.value != "" && txt_MaxA.value != "")
{
if (txt_MaxA.value - txt_MinA.value > 25)
{
msg = "A: The difference can't be over 25 mm.\n";
}
}
if (txt_MinB.value != "" && txt_MaxB.value != "")
{
if (txt_MaxB.value - txt_MinB.value > 25)
{
msg += "B: The difference can't be over 25 mm.\n";
}
}
if (txt_MinC.value != "" && txt_MaxC.value != "")
{
if (txt_MaxC.value - txt_MinC.value > 25)
{
msg += "C: The difference can't be over 25 mm.\n";
}
}
if (txt_MinD.value != "" && txt_MaxD.value != "")
{
if (txt_MaxD.value - txt_MinD.value > 25)
{
msg += "D: The difference can't be over 25 mm.\n";
}
}
return msg;
}