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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem in Javascript file

Problem in Javascript file

Scheduled Pinned Locked Moved ASP.NET
javascripthelp
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.
  • P Offline
    P Offline
    pinna_hari
    wrote on last edited by
    #1

    Hello, I Got a problem while writing code clientside validation. I have a textbox control in default.aspx. i am writing validation(required field validation) in .Js(Seperate Javascript) file I am writing like this function validate() { var=document.getElementID("<%= textbox1.ClientID %>").value if(var=="") alert(""); } here my problem is the above code is not calling textbox control in default.aspx. please give solution... Thanks

    Pinna

    C 1 Reply Last reply
    0
    • P pinna_hari

      Hello, I Got a problem while writing code clientside validation. I have a textbox control in default.aspx. i am writing validation(required field validation) in .Js(Seperate Javascript) file I am writing like this function validate() { var=document.getElementID("<%= textbox1.ClientID %>").value if(var=="") alert(""); } here my problem is the above code is not calling textbox control in default.aspx. please give solution... Thanks

      Pinna

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You should get firefox and firebug. If you did, you would see that a seperate js file is never parsed, so your code is being written verbatim. One way around this is to do something like: var=document.getElementID(textBoxClientId).value; Then write a variable called that using the ClientID in the code behind of the page. Also, NEVER use the result of getElementByID without first checking that it's not null.

      Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

      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