Web Analytics Made Easy -
StatCounter This piece is not working. - CodingForum

Announcement

Collapse
No announcement yet.

This piece is not working.

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

  • This piece is not working.

    Hi! Friends,
    Can any one of you help me out of this. My code reads as such.

    -____________________________________________________
    <script language="JavaScript">
    function verifyInfo()
    {
    alert("In Verify");
    for(i=0;i<10;i++)
    {
    if(document.Firstform.elements[i].value="")
    {
    document.Firstform.elements[i].value="NULL";
    }
    }
    execute();
    }
    function execute()
    {
    alert("In execute");
    document.Firstform.action="http://localhost/jewel/stock_items_data.asp";
    document.Firstform.submit()
    }
    </script>


    <form method="POST" name="Firstform" onSubmit="return verifyInfo()">
    <!-- other codes here -->
    <input type =submit>

    This code is not working. My job is to pass null values in whichever element the user has not entered the data. Then the data is inserted into the database.


    Thanks.
    Navin,.

  • #2
    try this:
    Code:
    <script language="JavaScript">
    function verifyInfo() {
        alert("In Verify");
        for(i=0;i<10;i++) {
            if(document.Firstform.elements[i].value=="") {
                document.Firstform.elements[i].value="NULL";
                }
            }
    
        }
    </script>
    
    <form method="POST"  action="http://localhost/jewel/stock_items_data.asp" name="Firstform" onSubmit="verifyInfo()">
    <!-- other codes here -->
    <input type =submit>
    Last edited by joh6nn; Jun 25, 2002, 07:44 AM.
    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
      if(document.Firstform.elements[i].value="")
      For performing a comparison, you have to use double equel signs

      like this

      if(document.Firstform.elements[i].value=="")


      Haris.
      The best way to make your dreams come true is to WAKE UP . . . !!!

      Comment

      Working...
      X