Event OnValidate gives no result after pressing on the submit button

Event OnValidate gives no result after pressing on the submit button

Hi I made a function that returns a string:

  1. string amount.getValue(int value)
    {
        errText = "";
        if (input.value  >  5)
        {
            errText = "unsufficient laptops";
        }
        else
        {
            errText = "sufficient laptops";
        }
        return errText;
    }











I also have a form with a textbox

When I press on the submit button it needs to call the function that i gave above with the value of the textbox as paramter.

I put this code on the event "OnValidate"

  1. amnt = input.Number_of_laptops.toLong();
  2. text = thisapp.amount.getValue(amnt);
  3. alert(text);
What do I do wrong?

I also just the the event with a standard alert ("test") but It doesn't give me anything.
I want the validation after I pressed on the submit button...