...

View Full Version : This piece is not working.



krnaveen
06-25-2002, 12:35 PM
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,.

joh6nn
06-25-2002, 12:42 PM
try this:

<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>

Haris
06-25-2002, 12:43 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum