2002-12-31 00:45:22 +00:00
|
|
|
- Javascript in CGI scripts
|
2002-12-30 22:58:51 +00:00
|
|
|
<form onsubmit=return(isRequired(document.checklinkForm)) name=checklinkForm ...>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
//Check for the required fields
|
2002-12-31 00:45:22 +00:00
|
|
|
function isRequired (thisForm) {
|
|
|
|
|
var empty = false;
|
|
|
|
|
// URI
|
|
|
|
|
if (isEmpty(thisForm.uri) || (thisForm.uri.value == "http://")) {
|
|
|
|
|
alert("The URL field is required. Please fill it in.");
|
|
|
|
|
thisForm.uri.select();
|
|
|
|
|
thisForm.uri.focus();
|
|
|
|
|
empty = true;
|
|
|
|
|
}
|
|
|
|
|
// verify URL format
|
|
|
|
|
if ((empty == false) && (verifyURI(thisForm.uri) == false)) {
|
|
|
|
|
alert("Invalid URL submitted. Please submit a valid URL.");
|
|
|
|
|
thisForm.uri.select();
|
|
|
|
|
thisForm.uri.focus();
|
|
|
|
|
empty = true;
|
|
|
|
|
}
|
|
|
|
|
return (!(empty));
|
|
|
|
|
}
|