Spry

Change required status of a text field

By default, Validation Text Field widgets require user input when published on a web page. You can, however, make the completion of text fields optional for the user.

 To change the required status of a text field, add the isRequired property to the constructor and set its value to false, as follows:
<script type="text/javascript">
	var tf1 = new Spry.Widget.ValidationTextField("textfieldwidget1", "none", {isRequired:false});
</script>
Note: In the preceding example, the second parameter is set to "none", but it could easily be set to any of the available validation types (for example, "phone" or "credit_card"). See Specify a validation type and format.