Hi. I have a form that has an onSubmit statement calling a javascript function with an arguement that is supposed to pass a form value. It looks something like this:
<script language="JavaScript">
function digit_check(input_string) {
if ( input_string.length==10 ) {
...
...
</script>
<form method="post" name="edit" action=.... onsubmit="javascript:return digit_check(phone_number)>
Phone Number : <input type="text" name="phone_number" value=<?php echo "$row[phone_number]" ?> />
...
...
If I output "input_string.value" from the function then I get the proper string. If I try to get its length "input_string.length" then I get an "undefined" message when I output the value. I have tried using the DOM to get the form value ie. document.form.phone_number... but that does not help. I know I am missing something really silly, somebody please help!
<script language="JavaScript">
function digit_check(input_string) {
if ( input_string.length==10 ) {
...
...
</script>
<form method="post" name="edit" action=.... onsubmit="javascript:return digit_check(phone_number)>
Phone Number : <input type="text" name="phone_number" value=<?php echo "$row[phone_number]" ?> />
...
...
If I output "input_string.value" from the function then I get the proper string. If I try to get its length "input_string.length" then I get an "undefined" message when I output the value. I have tried using the DOM to get the form value ie. document.form.phone_number... but that does not help. I know I am missing something really silly, somebody please help!