23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

•<br />

•<br />

•<br />

•<br />

no future<br />

no past<br />

no today<br />

a regular expression<br />

In our example, we use no empty.<br />

How to validate a form<br />

In the earlier chapters, we used WrongValueException to validate a<br />

single input field. However, when we click on the button and submit the<br />

data of form, validation doesn't happen automatically. To validate we<br />

have to call getValue() on an input field. If the validation is broken a<br />

popup occurs on the concerned field. If we want to prevent such popup,<br />

we can call the isValid() function and create our own error message.<br />

The complete login page (login.zul) is shown as follows:<br />

<br />

[ 101 ]<br />

Chapter 4<br />

<br />

<br />

<br />

import com.packtpub.zk.media.model.*;<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

empty"/><br />

<br />

<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!