weee
06-07-2004, 07:20 PM
Hi There.
I build a page that can contain up to 10 products with s simple form so the user can update the product name. the thing is that I'm trying to check out if the user entered a value into the field.
What I'm trying to do is giving the form name a like:
"productEdit1" and I'm giving the product id(1) to the JavaScript like that:
onSubmit="return checkProductEdit(1);"
This is the code:
function checkCompanyEdit(ddr){
if(productEdit+ddr.productName.value=="" || document.productEdit+ddr.productName.value.length<2)
{
document.getElementById('errDiv').innerHTML="2 letter at least";
document.productEdit+ddr.productName.focus();
return false;
}
}
The forms code:
<form name="productEdit1" method="post" action="#" onSubmit="return checkProductEdit(1);">
<b>שם המוצר:</b> בפלה<br>
<div id="errDiv"> </div><br>
<input type name="productName" size="30" value="בפלה"><br>
<input type="submit" value="עדכן">
</form>
<br><br>
<form name="productEdit2" method="post" action="companyHandler.asp" onSubmit="return checkProductEdit(2);">
<b>שם המוצר:</b> מוצרי<br>
<div id="errDiv"> </div><br>
<input type name="productName" size="30" value="מוצרי"><br>
<input type="submit" value="עדכן">
</form>
The problem is that it doesn't work. I don't know why?
any ideas?
Thanks guys!
I build a page that can contain up to 10 products with s simple form so the user can update the product name. the thing is that I'm trying to check out if the user entered a value into the field.
What I'm trying to do is giving the form name a like:
"productEdit1" and I'm giving the product id(1) to the JavaScript like that:
onSubmit="return checkProductEdit(1);"
This is the code:
function checkCompanyEdit(ddr){
if(productEdit+ddr.productName.value=="" || document.productEdit+ddr.productName.value.length<2)
{
document.getElementById('errDiv').innerHTML="2 letter at least";
document.productEdit+ddr.productName.focus();
return false;
}
}
The forms code:
<form name="productEdit1" method="post" action="#" onSubmit="return checkProductEdit(1);">
<b>שם המוצר:</b> בפלה<br>
<div id="errDiv"> </div><br>
<input type name="productName" size="30" value="בפלה"><br>
<input type="submit" value="עדכן">
</form>
<br><br>
<form name="productEdit2" method="post" action="companyHandler.asp" onSubmit="return checkProductEdit(2);">
<b>שם המוצר:</b> מוצרי<br>
<div id="errDiv"> </div><br>
<input type name="productName" size="30" value="מוצרי"><br>
<input type="submit" value="עדכן">
</form>
The problem is that it doesn't work. I don't know why?
any ideas?
Thanks guys!