HowToValidateVisualWebPageConditionally

Revision as of 18:22, 6 November 2009 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

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:
http://www.netbeans.org/kb/55/virtual-forms.html
http://www.netbeans.org/community/magazine/html/03/visualwebdev/



To learn more about conditional validation, see:
http://developers.sun.com/jscreator/reference/techart/2/conditional_validation.html
http://blogs.sun.com/jayashri/entry/conditional_validation_on_button_click
http://blogs.sun.com/david/entry/conditional_validation_in_java_studio


You can also use Ajax to implement selective processing. To learn about using Dynamic Faces technology in a visual web project, see:
http://www.netbeans.org/kb/60/web/ajaximportcomponents.html
http://www.netbeans.org/kb/60/web/instcurrencytrader.html
(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