< class="prominent-subhead ">

Form level validation with K2.net™ 2003 SmartForms

This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.


One of the best practices in any application development is proper client-side validation. Typically a developer using web-based forms for client pages in workflow processes will either use standard ASP.NET web pages or K2.net™ 2003 SmartForms. The following example allows developer to implement client-side validation on both VS.NET web pages and K2.net™ 2003 SmartForms.

For ASP.NET developers who would like to execute client-side script prior to a K2 SmartForm control posting to the server can use the script below:
  <body MS_POSITIONING="GridLayout" onload="return window_onload()">
    <form id="Form2" method="post" runat="server" enctype="multipart/form-data">
      <K2:K2Button id="K2Button1" style="Z-INDEX: 112; LEFT: 280px; POSITION: absolute; TOP: 216px" runat="server" Text="Submit" Type="PlanButton"></K2:K2Button>

    <!-- This script section must go after your closing form tag -->
    <script language="javascript" type="text/javascript">
      var bW3Compliant = (document.getElementById) ? 1 : 0;
        document.Form1.K2Button1.onclick = K2Button1_onclick;
      function K2Button1_onclick()
      // fires prior to server posting.
        return (confirm("Are you sure you would like to start this process?")) ? true : false;