12.07.2015 Views

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11 ■ PAGES AND COMPONENTSISBN :Title :Price :Description :Number of pages :Illustrations :APress - <strong>Beginning</strong> <strong>Java</strong> <strong>EE</strong> 6In Listing 11-4, the priceRequired() <strong>Java</strong>Script function is embedded in the page <strong>with</strong>in a tag. This function is called when the price text field loses the focus (that’s what the onblur event does).The priceRequired() function uses the implicit document object that represents the DOM of the XHTMLdocument. The getElementById("price") method looks for an element that has an identifier called price() and checks whether it’s empty. If so, the function looks for another element calledpriceError (getElementById("priceError")) and sets the value to Please, fill the price !. If the priceis not completed, the client validation will display the message shown in Figure 11-4.305

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!