Highlighting Table Data Fields When User Doesnt Enter Data To A Text Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Thimali
    New Member
    • Sep 2007
    • 1

    Highlighting Table Data Fields When User Doesnt Enter Data To A Text Box

    Hi all,
    I have a web page which is having a text box.I have already validated this using java script.Now i want to validate this same text box without prompting the error message.I need to change the corresponding table data field colour in to red(which would indicate the place which user doesn't have entered value)
    If anybody is having an idea pls share with me.
    Thx
    Thimali
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by Thimali
    Hi all,
    I have a web page which is having a text box.I have already validated this using java script.Now i want to validate this same text box without prompting the error message.I need to change the corresponding table data field colour in to red(which would indicate the place which user doesn't have entered value)
    If anybody is having an idea pls share with me.
    Thx
    Thimali
    Welcome to TSDN.
    Good idea.
    But first try some code then come here with your specific Code.
    Then experts are here to solve your Problem.
    Good luck with your try.

    Kind regards,
    Dmjpro.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by Thimali
      I have a web page which is having a text box.I have already validated this using java script.Now i want to validate this same text box without prompting the error message.I need to change the corresponding table data field colour in to red(which would indicate the place which user doesn't have entered value)
      Post what code you have so far. Do you want to change the background colour?

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Thimali. Welcome to TSDN!

        Simply change the element's background color:
        [code=javascript]
        document.getEle mentById('idOfE lementGoesHere' ).style.backgro undColor = '#ff9999';
        [/code]

        Comment

        • iam_clint
          Recognized Expert Top Contributor
          • Jul 2006
          • 1207

          #5
          Originally posted by Thimali
          Hi all,
          I have a web page which is having a text box.I have already validated this using java script.Now i want to validate this same text box without prompting the error message.I need to change the corresponding table data field colour in to red(which would indicate the place which user doesn't have entered value)
          If anybody is having an idea pls share with me.
          Thx
          Thimali
          Example
          [CODE=javascript]
          function example(obj) {
          obj.style.backg roundColor="red ";
          }

          <input type="text" onblur="example (this);">
          [/CODE]

          Comment

          Working...