Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. field validation in content pages

field validation in content pages

Scheduled Pinned Locked Moved ASP.NET
javascripthtmlquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hahii
    wrote on last edited by
    #1

    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; } }

    F 1 Reply Last reply
    0
    • H hahii

      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; } }

      F Offline
      F Offline
      firozu
      wrote on last edited by
      #2

      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>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups