field validation in content pages
-
Hi, I have a content page and I have textboxes for name, address, phoneNumber, email address. But how can i use the following javascript for form validation because in contentpage there is no html head and body section. function FormValidate() { if(this.txtPhone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1) { alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx."); return false; } }
-
Hi, I have a content page and I have textboxes for name, address, phoneNumber, email address. But how can i use the following javascript for form validation because in contentpage there is no html head and body section. function FormValidate() { if(this.txtPhone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1) { alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx."); return false; } }
You can add a tag inside "asp:content" tag and call the javascript functions. e.g. - asp:Content ID="Content1" ContentPlaceHolderID="ContentHolderID" Runat="server"> <script type="text/javascript" language="javascript"> function FormValidate() { .... Hope this helps. </x-turndown>