siggles
07-04-2007, 10:53 PM
Hi all,
Not sure if this should be in this thread as is my first post :confused: but here goes.
I have created a small address book built in PHP & MySQL. The following are snippets from my page named insert.php. This page inserts a record into the database - which is working fine but.....
On this page I have the following fields:
first_name - first name of contact
middle_name - middle name of contact
last_name - last name of contact
display_name - the name to be displayed on the main page of the address book (for thois who are unfamiliar check out Contacts in MS Outlook).
When a user enters the last name I want the display_name to default to first_name & last_name BUT I keep getting a stupid error saying "Object Expected". For the life of me I can't figure this out so please - HEEEEELLLP :( :( :confused: :confused: :confused:
Here is the code:
<label class="secondlabels">first name:</label><input type="text" name="first_name" size="50" class="requiredinput"/><br>
<label class="secondlabels">middle name:</label><input type="text" name="middle_name" size="50"/><br>
<label class="secondlabels">last name:</label><input type="text" name="last_name" size="50" class="requiredinput" onblur="func_display_name();"/><br>
<label class="secondlabels">display name:</label><input type="text" name="display_name" size="50" class="requiredinput"/><br>
and the function:
<script language="JavaScript">
function func_display_name() {
form=document.insert_contact
if (form.first_name.value=="" || form.last_name.value=="") {
form.display_name.value ="";
alert("You haven't entered a first name or last name. Please do this now.");
} else {
form.display_name.value = form.first_name.value . " " . form.last_name.value;
}
</script>
Not sure if this should be in this thread as is my first post :confused: but here goes.
I have created a small address book built in PHP & MySQL. The following are snippets from my page named insert.php. This page inserts a record into the database - which is working fine but.....
On this page I have the following fields:
first_name - first name of contact
middle_name - middle name of contact
last_name - last name of contact
display_name - the name to be displayed on the main page of the address book (for thois who are unfamiliar check out Contacts in MS Outlook).
When a user enters the last name I want the display_name to default to first_name & last_name BUT I keep getting a stupid error saying "Object Expected". For the life of me I can't figure this out so please - HEEEEELLLP :( :( :confused: :confused: :confused:
Here is the code:
<label class="secondlabels">first name:</label><input type="text" name="first_name" size="50" class="requiredinput"/><br>
<label class="secondlabels">middle name:</label><input type="text" name="middle_name" size="50"/><br>
<label class="secondlabels">last name:</label><input type="text" name="last_name" size="50" class="requiredinput" onblur="func_display_name();"/><br>
<label class="secondlabels">display name:</label><input type="text" name="display_name" size="50" class="requiredinput"/><br>
and the function:
<script language="JavaScript">
function func_display_name() {
form=document.insert_contact
if (form.first_name.value=="" || form.last_name.value=="") {
form.display_name.value ="";
alert("You haven't entered a first name or last name. Please do this now.");
} else {
form.display_name.value = form.first_name.value . " " . form.last_name.value;
}
</script>