For example, create a folder called SpryAssets in the root folder of your web site, and upload the SpryValidationTextarea.js file to it. The SpryValidationTextarea.js file contains all of the information necessary for making the Text Area widget interactive.
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
Make sure that the file path to the SpryValidationTextarea.js file is correct. This path varies depending on where you’ve placed the file in your web site.
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
Make sure that the file path to the SpryValidationTextarea.css file is correct. This path varies depending on where you’ve placed the file in your web site.
<textarea name="mytextarea" id="textarea"></textarea>
<span id="sprytextarea1"> <textarea name="mytextarea"></textarea> </span>
<script type="text/javascript"> var ta1 = new Spry.Widget.ValidationTextarea("sprytextarea1"); </script>
The new JavaScript operator initializes the Text Area widget object, and transforms the span tag content with the ID of sprytextarea1 from static HTML code into an interactive text field object. The Spry.Widget.ValidationTextarea method is a constructor in the Spry framework that creates text area objects. The information necessary to initialize the object is contained in the JavaScript library, SpryValidationTextarea.js, that you linked to at the beginning of this procedure.
Make sure that the ID of the text area’s container span tag matches the ID parameter you specified in the Spry.Widgets.ValidationTextarea method. Make sure that the JavaScript call comes after the HTML code for the widget.
The complete code looks as follows:
<head> ... <script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script> <link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" name="form1" method="post" action=""> <span id="sprytextarea1"> <textarea name="textarea1" id="textarea1" cols="45" rows="5"></textarea> </span> </form> <script type="text/javascript"> var ta1 = new Spry.Widget.ValidationTextarea("sprytextarea1"); </script> </body>