Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Delhi, India
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 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
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    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; 06-25-2002 at 12:44 PM.
    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.

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    God's own country
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •