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. need help on custom validation

need help on custom validation

Scheduled Pinned Locked Moved ASP.NET
questionjavascripthelp
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.
  • T Offline
    T Offline
    the pink jedi
    wrote on last edited by
    #1

    I need to do 1 client side validation: 1. if the checkbox is checked, the corresponding TextBox must not be empty. 2. The TextBox field must be empty if the chcekbox is not checked how do i use the custom validation with javascript to accomplish that? thanks in advance

    M 1 Reply Last reply
    0
    • T the pink jedi

      I need to do 1 client side validation: 1. if the checkbox is checked, the corresponding TextBox must not be empty. 2. The TextBox field must be empty if the chcekbox is not checked how do i use the custom validation with javascript to accomplish that? thanks in advance

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, You can provide your own validation function at the client side in the ClientValidationFunction property of the CustomValidator[^]. Also you should remember that if you set the ControlToValidate property of the validator to the tetxbox control, then the validator will skip your own custom validator when the textbox is empty. So you don't need to set this property and leave it empty. In your own validation function, you can provide a snippet of script to check the checked property of the checkbox and the value of the input textbox control. You can also wrap everything up in your own custom validator, for more information see Developing a Validator Control[^]

      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