Form problem. Receive"null or not an object" error message

wxdqz

New Member
Hello everybody,

I am designing a web site where the clients fill in forms and submit orders.

I have 4 pages and 2 of them have forms.
In the forms I ask for personal details which I send to a database. Everything works fine up to that point.

The problems start when I want to generate a unique reference number that consists of a surname, date and time.

I inserted the following script in the head section:

<script language = "JavaScript">
var date1 = new Date()
var mont = date1.getMonth() + 1 // To display the correct month
</script>

I inserted the following script into the input tag of the submit button:

<input type="submit" value=http://www.webdeveloper.com/forum/archive/index.php/"Submit" name="B1" onClick = "document.Clients.RefNo.value = document.Clients.Surname.value + date1.getDate() + mont + date1.getHours() + date1.getMinutes()" >

Where:
Clients - name of form
RefNo - name of textbox
Surname - name of textbox

I have a one page web (the Try page) where I try out script before I use it in the main site. The above works perfectly in the Try page.

When I insert the code into the main page, I get the following error message:'document.Clients.RefNo' is null or not an object.

I have tried various other syntaxes without success. The only difference between the Try and main pages, is that Try only has one page and I use an ordinary button there to test the script.

I would appreciate it if somebody could put me on the right track.

Thanks,

Jan van Heerden
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
 
Back
Top