Hi,
Sorry more probs with my form validation. Here is a bit of my validation code and it doesn't work at the moment. I think the problem is trying access form fields from the function when only the button value is passed in.
It is important that this function is called by onclick of a button rather then onsubmit in the form tag.
Thge form name and id is 'myform'.
i think it's just syntax tho....
If 'oktosubmit' is true then further code is executed if not then the function returns false.
Thanks
Sorry more probs with my form validation. Here is a bit of my validation code and it doesn't work at the moment. I think the problem is trying access form fields from the function when only the button value is passed in.
It is important that this function is called by onclick of a button rather then onsubmit in the form tag.
Thge form name and id is 'myform'.
i think it's just syntax tho....
Code:
function mysubmitfunction(objButton) {
var oktosubmit = true;
// do some client checking here if all the form elements contain valid data.
// a form element can be addressed like this:
// eval('myform.myelement').value
// if you cannot submit because some data in the form is not valid
// you have to set the oktosubmit to false
if (objButton.name=="update_but") {
if ('myform.update').value == "" {
alert("Please select an entry to update.");
oktosubmit = false;
}
}
if (objButton.name=="delete_but") {
if ('myform.delete').value == "" {
alert("Please select an entry to delete.");
oktosubmit = false;
}
}
If 'oktosubmit' is true then further code is executed if not then the function returns false.
Thanks