No major problems with the code as such, and it works as expected (not as you expect it to, however). The reason for that discrepancy would be that your expectations are misplaced.
1. "It seems the onclick code for both the Submit and the Reset buttons does not do anything." Actually, it does exactly what it is supposed to: ~ The Submit button is an <input type="submit"> button and it will submit the form to the resource specified in the form action attribute (in this case, "default.aspx"). It does so. ~ The Reset button is an <input type="reset"> button which resets the form to original values. It does not work as you intend because the reset button is a special type understood by browsers and they always reset the form when it is clicked. You cannot override this behaviour because it internally calls the form objects reset() method. 2. "but the javascript code is not being used" All the JS code is invoked at the right time. 3. " I'm suspecting for some reason it is not recognizing the "defaultPage" objects" It should, as long as you are using IE. If you're using Mozilla or any other browser, you cannot access form fields this way. It's better to use the standard "document.getElementById()" method. 4. "I set breakpoints, but they're not breaking." Javascript breakpoints do hit in VS 2008, if you are running in debug mode. If you're talking about the code-behind breakpoints, they will not be hit because you don't have any code executing on the server side upon postback. This form simply submits to the Default.aspx page and the breakpoints set in that page will be hit on postback. This is a plain vanilla HTML page with a little Javascript validaton... nothing ASP.NET per se in this page (other than the declaration and stuff). Let us know if you have further doubts. As a side note, when posting code snippets, please use the editor at dotnetdevelopment.pastebin.com (as described in the Group welcome message). On Aug 5, 7:58 am, David Ford <[email protected]> wrote: > I'm working from the book "Pro C# 2008 and the .NET 3.5 Platform". > I'm using VS 2008. > > I'm entering this sample code. It seems the onclick code for both the > Submit and the Reset buttons does not do anything. I can tell the > page is sent, as the values get wiped out, but the javascript code is > not being used. > > The Help button works. I'm suspecting for some reason it is not > recognizing the "defaultPage" objects. I set breakpoints, but they're > not breaking. > > Any help would be appreciated. I'm brand new at ASP.NET. >
