Web Analytics Made Easy -
StatCounter How to pass NULL values to the elements the user left blank. - CodingForum

Announcement

Collapse
No announcement yet.

How to pass NULL values to the elements the user left blank.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to pass NULL values to the elements the user left blank.

    Hi! Friends,
    Help me out, Pls.
    Am having a form containing ten elements which is used to insert values in the database. The user has the option to enter a value or leave it blank, for any of the element. How do I pass NULL values to the element which the user has left blank ? Am trying to use Javascript but not yet successfull. The query does not execute without passing NULL values for the fields left blank. If all the fields have the value then its working perfectly fine. Am using ASP for server side programming and HTML for Client-side.
    Urgent.
    -Navin.

  • #2
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

    Comment


    • #3
      <html>
      <head>
      <script type="text/javascript">

      function setNULLS(f) {
      var currEl, e = 0;
      while (currEl = f.elements[e++])
      if (currEl.type == 'text' && !currEl.value) currEl.value = 'NULL';
      }

      </script>
      </head>

      <body>
      <form onsubmit="setNULLS(this)">
      <input name="t1" type="text"><br>
      <input name="t2" type="text"><br>
      <input name="t3" type="text"><br>
      <input name="t4" type="text"><br>
      <input name="t5" type="text"><br><br>
      <input type="submit" value="DONE">
      </form>
      </body>
      </html>
      Last edited by adios; Jun 29, 2002, 01:45 PM.

      Comment

      Working...
      X