Hi Paul,

ValueChanged Listener will be called only if the value changes.

Isn't it possible to do the validation on FocusLost event?

Alternatively you could extend the component to set an InputVerifier on the
client side:

Server-side class:

        public class ULCMyTextField extends ULCTextField {

                public ULCMyTextField(int i) {
                        super(i);
                }

                protected String typeString() {
                        return "mypackage.UIMyTextField";
                }

        }

Client-side class:

        public class UIMyTextField extends UITextField {

                protected void postInitializeState() {
                        super.postInitializeState();
                        getBasicTextField().setInputVerifier(new 
InputVerifier() {

                                public boolean verify(JComponent input) {
                                        JTextField  text = ((JTextField)input);
                                        return text.getText().equals("pass");
                                }

                        });
                }

        }

The advantage is that there will be no server round trip.

The disadvantage is that your business logic is moving to the client and if
you have to do complex validation against your business objects then you
will have to make all that available on the client.

I hope this helps.

Thanks and regards,

Janak

>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of
>[EMAIL PROTECTED]
>Sent: Monday, October 16, 2006 2:38 PM
>To: [email protected]
>Subject: [ULC-developer] component validation - Navigation
>
>
>Hi all
>
>I have to perform validation on a text field/ check box / radio
>group etc and if the validation fails then the focus should stay
>within the item being validated. I have added a value changed
>listener and reset the focus back to the item being validated but
>after being validated once and the user navigates out again the
>value changed will not be called. Also, if the validation is being
>performed within a dialog window with a default button set then
>there is also a problem. the user changes the text in a text field
>and hits enter, the validation method is called but the button is
>also being pressed i.e. Focus does not stay in the item being validated.
>
>I dont want any navigation out of the field until the validation
>method returns true. I have seen an InputVerifier in Swing that
>seems to provide exactly the required functionality but I don't
>know how to implement this in ULC. Or do you have any other ideas?
>
>I have searched the archives for an answer to my problem, but have
>not found anything so I would be gratefull for your help
>
>Paul Harrison
>
>
>_____________________________________________________________
>NEU: Ihre Photos online verwalten, mit anderen teilen und die
>besten Bilder gleich entwickeln lassen - GRATIS für den 1. Monat
>(exkl. Entwicklung)
>www.sunrise.ch/photoalbum
>_______________________________________________
>ULC-developer mailing list
>[email protected]
>http://lists.canoo.com/mailman/listinfo/ulc-developer

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to