For example, create a folder called SpryAssets in the root folder of your web site, and move the SpryValidationConfirm.js file to it. The SpryValidationConfirm.js file contains all of the information necessary for making the Confirm widget interactive.
<script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
Make sure that the file path to the SpryValidationConfirm.js file is correct. This path varies depending on where you’ve placed the file in your web site.
<link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
Make sure that the file path to the SpryValidationConfirm.css file is correct. This path varies depending on where you’ve placed the file in your web site.
<input type="password" id="password1" name="password1" />
<input type="password" id="password1" name="password1" /> <input type="password" name="fieldName" value="" />
<input type="password" id="password1" name="password1"/> <span id="ConfirmWidget"> <input type="password" name="fieldName" value=""/> </span>>
<script type="text/javascript"> var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("spryconfirm1", "password1"); </script>
The first required value in the constructor is the ID of the widget container. The second required value is the ID of the password field that is being confirmed.
Make sure that the ID of the Confirm widget’s container span tag matches the ID parameter you specified in the Spry.Widgets.ValidationConfirm method. Make sure that the JavaScript call comes after the HTML code for the widget.
The complete code looks as follows:
<head> ... <script src="includes/SpryValidationConfirm.js" type="text/javascript"></script> <link href="includes/SpryValidationConfirm.css" rel="stylesheet" type="text/css" /> ... </head> <body> ... <input type="password" id="password1" name="password1" /> <span id="ConfirmWidget"> <input type="password" name="fieldName" value=""/> </span> <script type="text/javascript"> var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("ConfirmWidget","password1"); </script> ... </body>