Hi,
I'm facing a pretty peculiar problem.
In one of my pages I print the number of rows depending upon the number of Qty I got filled in my previous page i.e. If Qty is filled in as 3 in previous page 3 rows would be printed on my current page or, if 5 being entered in the previous page 5 rows would get printed in my current page & so on.
Now the problem is, I want to check whether the required fields in each row has been filled or, not. If not ONSUBMIT the page should display an alert msg stating the specified field has to be filled.
This is the Javascript function I tried using but after certain time I get an alert stating The script is taking too long. Continuing this script may make the system unresponsive... ...The problem remains same both with IE7 & Firefox v2.0.0.3. I'm using this javascript function in a PHP page.
I guess this is because of this line "f1.inventory+i .value==0" i.e. its not filling in "inventory+ i" as inventory1, inventory2, inventory3 & so on.
Kindly help me with a function that could help me check my n number of rows for n number of fields.
I'm facing a pretty peculiar problem.
In one of my pages I print the number of rows depending upon the number of Qty I got filled in my previous page i.e. If Qty is filled in as 3 in previous page 3 rows would be printed on my current page or, if 5 being entered in the previous page 5 rows would get printed in my current page & so on.
Now the problem is, I want to check whether the required fields in each row has been filled or, not. If not ONSUBMIT the page should display an alert msg stating the specified field has to be filled.
Code:
function checkfields(f1)
{
i = 0
while (i <= <?php echo $Qty; ?>)
{
if(f1.inventory+i.value==0)
{
alert("Please enter the Inventory Item");
f1.inventory+i.focus();
return false;
}
}
}
</script>
I guess this is because of this line "f1.inventory+i .value==0" i.e. its not filling in "inventory+ i" as inventory1, inventory2, inventory3 & so on.
Kindly help me with a function that could help me check my n number of rows for n number of fields.
Comment