Revision as of 12:06, 5 November 2009 by Admin (Talk | contribs)

How do I conditionally validate fields and ignore others on submit?

You can employ techniques for selective processing and conditional validation. Though related, selective processing and conditional validation are different. Selective processing entails processing different sets of input components depending on the user gesture. For instance, you may want to process input components A and B if the user clicks button X and input components B and C if the user clicks button Y. You can use virtual forms to implement selective processing. With selective processing, the input components that are selected for processing undergo all the processing steps, including conversion, all configured validation checks, and mapping onto binding targets. In contrast, conditional validation entails performing different validation checks depending on the user gesture. For instance, when the user clicks either button X or Y, you may want to process input component A, including mapping the value onto its binding target in a session-scoped bean. However, as part of that processing, you want to require the user to supply a value only if the user clicks button Y. There is more than one technique for implementing conditional validation.

To learn more about virtual forms, see:

To learn more about conditional validation, see:

You can also use Ajax to implement selective processing. To learn about using Dynamic Faces technology in a visual web project, see:
(An article on how to build an Ajax chat room with Dynamic Faces technology is forthcoming.)

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo