Why not use "onchange" and validate the field when the user changes the
input?

All you would have to do is add your validators as you would normally do,
then create Ajax*** form components and in their callback method for
onError(target) refresh your feedback panel.

A text field with this design applied to it will validate the user input for
each character typed, use a different JS event for other behavior.

For code examples see:
http://www.wicket-library.com/wicket-examples/ajax/form

~ Thank you,
  Paul Bors

-----Original Message-----
From: Sandor Feher [mailto:sfe...@bluesystem.hu] 
Sent: Tuesday, August 28, 2012 3:37 PM
To: users@wicket.apache.org
Subject: RE: Nested form submit problem

Hi Paul,

The problem related to AjaxFormSubmitBehavior  behaviour. This fires eform's
onSubmit event.
My original goal was to create field level validation with Ajax nothing
more.
The code above looks for a description belongs to the entered value and
displays it.
If the entered value validation failed then warns the user immediately. 
BTW if I turn of afvb setDefaultFormProcessing to false then the field level
validation does not work.


-----------------------
              AjaxFormSubmitBehavior afvb=
                new AjaxFormSubmitBehavior(eform, "onchange") {
                 
 
                    @Override
                    protected void onSubmit(AjaxRequestTarget art) {
                        HrpBbheertk ertk = (HrpBbheertk)
eform.getModelObject();
                        String k = ertek.getValue();
                        customBo.getDaoSession().beginTransaction();
                        HrpBbhepar5PK pk = new HrpBbhepar5PK();
                        pk.setCompany(ertk.getHrpBbheertkPK().getCompany());
                       
pk.setAkodszam(ertk.getHrpBbheertkPK().getAlaptipus());
                       
pk.setDkodszam(ertk.getHrpBbheertkPK().getDimenzio());
                       
pk.setDekodszam(ertk.getHrpBbheertkPK().getDimenzioelem());
                        if (!k.isEmpty()) {
                            pk.setDertek(Short.valueOf(k));
                            HrpBbhepar5 hepar5 =
customBo.find(HrpBbhepar5.class, pk);
                            if (hepar5 != null) {
                               
dimenev.setDefaultModelObject(hepar5.getDertekmegnev());
                            } else {
                                dimenev.setDefaultModelObject("");
                            }

                        }
                        if
(customBo.getDaoSession().getTransaction().isActive()) {
                           
customBo.getDaoSession().getTransaction().commit();
                        }

                        art.add(dimenev);
                        art.add(fb);
                    }

                    @Override
                    protected void onError(AjaxRequestTarget art) { 
                        art.add(fb);
                    }

                };



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Nested-form-submit-problem-tp4651
565p4651568.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to