Re: Javascript and $_POST
| From: | Jon Anderson | Date: | Thu, 08 Feb 2007 14:07:13 +0000 |
| Subject: | Re: Javascript and $_POST | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248576@lists.php.net to get a copy of this message | ||
Dan Shirah wrote:
Jon, Tried your method and still got: *Error: Object doesn't support this property or method. Code: 0* *I don't know what browser/platform you're using, but the following works for me on IE7/Windows, FF2/Linux, Opera9/Linux.jon <html> <head> <script language="JavaScript"> function checkInputValue(item,onError) { if (item = document.getElementsByName(item)[0]) {
if (item.value != "") {
return(true);
}
item.focus();
}
** alert(onError);
**return(false);*
*}
function checkForm() {
elements = new Array('cc_phone_number');
errors = new Array('Please enter a phone number');
for (i=0;i<elements.length;i++) {
if (!checkInputValue(elements[i],errors[i])) {
return(false);
}
}
document.getElementsByName('inputForm')[0].submit();
}
</script>
</head>
<body>
<form name="inputForm" method="post" enctype="multipart/form-data">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="680">
<tr>
<td><input type="text" name="cc_phone_number" />
</tr>
<tr>
<td width="64" align="left"><a href="#" onclick="javascript:checkForm();return(false);" title="Save">Save</a></td>
</tr>
</table>
</form>
</body>
</html>
*