Thankyou for your very extensive reply. I have been trying to implement
the function you replied to me with but unfortunately without much success.
Just to recap - I'm trying to validate a forms data entries and submit the
form values automaticaly. As I mentioned the page was working perfectly
with an update button to validate and update each row of data (as each
line of data is contained in a form on the page) however the client does
not want to press the update button!!
Jusdt to give you an idea:
Fields on the form are (for each record)
CargoNo / StartDt / Day1 / Day2 / Vol
Each record contains its own <Update> button which does two things:
1 Validates form via the onSubmit function of the form:
onSubmit="returm FormValidator(this)"
2 Fires two vb script functions, let's call them UpdateRecords1 and
UpdateRecords2
It does this via the Update button whose value is "Upd", so when the
validation is done successfully the submit goes ahead via a familiar call:
if Request("btnAddOperator")="Upd" then....
call
UpdateRecords1
UpdateRecords2
However I can't think of a way to implement this with your function
without the update button!!
Also I tried calling the function on the onChange event of each field on
the form in this format:
onChange="Checking()"
but without success! I planted alerts at various points but the script
only proceeded to alert2.
Any ideas?
function Checking()
{
alert("We are here");
var oForm;
var blnBlank;
var sTemp = new String;
// form object
oForm = fEdit; // Builder is the name of the form
alert("We are here2");
blnBlank = false;
// loop through the form elements
for (i=0; i < oForm.length; i++)
{
sTemp = oForm.elements[i].name;
alert("We are here3");
// check for blanks
if ((oForm.elements[i].value == '') && (sTemp.substr(0,6) !
= 'Length'))
blnBlank = true;
}
if (blnBlank)
{
alert("You have left required fields blank");
}
else
{
alert("We are here4");
document.fEdit.submit();
}
}