Posts: 130
Location: Atlanta, Georgia
|
I've got a form, and I have a function that [is supposed to] takes the value of part of the form, and sets it as the hidden value called "user". If the user value is blank, for form will return false, and give an alert. For some reason, my function won't do anything, and I think it's because I use a variable in my document call... Here's my codes...
The Function...
HTML Code:
<script language="JavaScript">
function refresh_user(formname, fieldname){
var user = document.formname.fieldname.value
document.formname.user.value = user
if (user.length < 1){
alert("Provide A User Value In The Form!")
return false;
} else {
return true;
}
}
</script>
And the form syntax...
HTML Code:
<form onSubmit="return refresh_user(addadmin, id);" name="addadmin" action="'.$currentquery.'&sub3=add" method=post>
<input type=hidden name=user value="">
<table><td width=100>User ID:</td><td><input type=text name=id size=3></td></table>
Those are the parts that're needed to help out... Thanks, in advance.
__________________
Please login or register to view this content. Registration is FREE - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.
|