Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

XHTML Strict and Forms

Did you know that with XHTML Strict, a <form> element can't have a name attribute? Actually, the only required attribute is action. But, if you do want to identify your form, then you have to use the id attribute. The problem with this is that many of us web developers are used to referencing a form (with Javascript) with document.formName. So as a service to my readers, if you do decide to XHTML 1.0 Strict, you will need to reference your forms (in Javascript) using one of the following syntaxes. For the sake of this example, pretend our form is named "webForm":

document.getElementById("webForm);
// assuming it's the first form on the page.
document.forms[0]; 
document.getElementsByTagName("form").item(0);

Of course, if you're trying to get the value <input> tag within your form, and that input has an id attribute, you can just get that using document.getElementById("inputId");.

You ask - what insired you to post this? Well, the Struts enhancement to produce XHTML-compliant code from the tag libraries. It was closed yesterday, and they seemed to have missed this - in other words, the <form> still has a name attribute. It'll be interesting to see how they resolve this. I'm hoping that Struts is not tied to the name attribute at all, and the fix just requires a bunch of fixes to Javascript that is written (by the tags).

Posted in Java at Nov 20 2002, 03:41:06 AM MST Add a Comment
Comments:

Post a Comment:
  • HTML Syntax: Allowed