View Single Post
Old 03-18-2012, 05:04 AM   PM User | #21
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,555
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
As Philip kept telling you, you can't use the code
Code:
document.orders
unless you have a <form> with that name.

You do *NOT* have such. You have a <form> with that ID!

You could fix this part by changing to
Code:
<form name="orders" method="post" action="done.htm">
But form names are considered obsolescent, anyway. So better to leave the <form> tag as you have it and simply change to using
Code:
document.getElementById("orders")
I would suggest this:
Code:
function initForm() {
   var form = document.getElementById("orders");
   form.date.value = todayTxt();
   form.qty1.focus();
   form.qty1.select();
}
************

You do have another problem, though. You can't use method="post" if the action= of a <form> is another HTML page. You can only use method="post" when the target action is a server-side page (e.g., a PHP or ASP or JSP or CGI page).

Now, if your <form> will never actually be submitted to the action page (which may well be the case for this page you are working on), then the method won't matter. But as a matter of good practice, if you are going to specify action="done.htm" then you should also specify method="get"
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
jdpaul (03-19-2012)