Spread ASP.NET 17
Spread for ASP.NET 17 Product Documentation / Client-Side Scripting Reference / Scripting Overview / Some Simple Uses of Client Scripting / Doing a Quick Validation Before Postback
In This Topic
    Doing a Quick Validation Before Postback
    In This Topic

    You can use client-side scripting in Spread to get the Update button and map your own click event for it. This allows you to perform client-side validations before the data gets posted to the server. If it succeeds, then the Update postback occurs. The following code sets up this validation.

    JavaScript
    Copy Code
    <script language="javascript">
      function window.onload()
      {
        var updbtn = FpSpread1.all("FpSpread1_Update");
        updbtn.onclick = test;
      }
    
      function test()
      {
        if(succeeds)
          _doPostBack(FpSpread1.id, "Update");
      }
    </script>
    

    This example checks to see if cell A1 is greater than 3.

    JavaScript
    Copy Code
    <script language="javascript">
      window.onload = function ()
            {
                var updbtn = FpSpread1.all("FpSpread1_Update");
                updbtn.onclick = test;
            }
            function test()
            {
                if (FpSpread1.GetValue(0, 0) > 3)
                    FpSpread1.Update();
            }
    </script>