RE: AjaxFormComponentUpdatingBehavior, required fields and validation

2012-01-03 Thread Michal Wegrzyn
Any ideas here? Should I provide a quickstart?

Best regards,
Michal Wegrzyn

 -Original Message-
 From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
 Sent: Monday, December 19, 2011 23:07
 To: users@wicket.apache.org
 Subject: AjaxFormComponentUpdatingBehavior, required fields and
 validation
 
 Hi,
 
 I have form with few TextField and DropDownChoice components. All of
 them have added AjaxFormComponentUpdatingBehavior( onkeyup ) and are
 set as required. Some of them are wrapped in my custom objects, but it
 does not matter (validation and processing logic is in behavior).
 
 With this setup after every ajax update triggered with behaviour's
 onUpdate( AjaxRequestTarget ) or onError( AjaxRequestTarget ) I try to
 check if form components are valid and give instant feedback to user.
 
 Unfortunately results obtained from component's isValid() are wrong.
 Empty TextFields are almost always valid.
 Only after clearing TextField error is added to component, but after
 changing for example other TextField to whatever value (and thus
 triggering next validation check) isValid() on blank, required
 TextField returns true.
 
 Is this approach incorrect or am I missing something?
 
 Best regards,
 Michal Wegrzyn
 


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



Re: AjaxFormComponentUpdatingBehavior, required fields and validation

2012-01-03 Thread Sven Meier

Hi,

are you validating all form components or just the one which triggered 
the ajax request?


You know AjaxFormSubmitBehavior?

Sven

Am 03.01.2012 09:32, schrieb Michal Wegrzyn:

Any ideas here? Should I provide a quickstart?

Best regards,
Michal Wegrzyn


-Original Message-
From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
Sent: Monday, December 19, 2011 23:07
To: users@wicket.apache.org
Subject: AjaxFormComponentUpdatingBehavior, required fields and
validation

Hi,

I have form with few TextField and DropDownChoice components. All of
them have added AjaxFormComponentUpdatingBehavior( onkeyup ) and are
set as required. Some of them are wrapped in my custom objects, but it
does not matter (validation and processing logic is in behavior).

With this setup after every ajax update triggered with behaviour's
onUpdate( AjaxRequestTarget ) or onError( AjaxRequestTarget ) I try to
check if form components are valid and give instant feedback to user.

Unfortunately results obtained from component's isValid() are wrong.
Empty TextFields are almost always valid.
Only after clearing TextField error is added to component, but after
changing for example other TextField to whatever value (and thus
triggering next validation check) isValid() on blank, required
TextField returns true.

Is this approach incorrect or am I missing something?

Best regards,
Michal Wegrzyn



-
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



Re: AjaxFormComponentUpdatingBehavior, required fields and validation

2012-01-03 Thread Martin Grigorov
Additionally keyup for select is not the best event.
People prefer using the mouse to change the value.

On Tue, Jan 3, 2012 at 11:13 AM, Sven Meier s...@meiers.net wrote:
 Hi,

 are you validating all form components or just the one which triggered the
 ajax request?

 You know AjaxFormSubmitBehavior?

 Sven

 Am 03.01.2012 09:32, schrieb Michal Wegrzyn:

 Any ideas here? Should I provide a quickstart?

 Best regards,
 Michal Wegrzyn

 -Original Message-
 From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
 Sent: Monday, December 19, 2011 23:07
 To: users@wicket.apache.org
 Subject: AjaxFormComponentUpdatingBehavior, required fields and
 validation

 Hi,

 I have form with few TextField and DropDownChoice components. All of
 them have added AjaxFormComponentUpdatingBehavior( onkeyup ) and are
 set as required. Some of them are wrapped in my custom objects, but it
 does not matter (validation and processing logic is in behavior).

 With this setup after every ajax update triggered with behaviour's
 onUpdate( AjaxRequestTarget ) or onError( AjaxRequestTarget ) I try to
 check if form components are valid and give instant feedback to user.

 Unfortunately results obtained from component's isValid() are wrong.
 Empty TextFields are almost always valid.
 Only after clearing TextField error is added to component, but after
 changing for example other TextField to whatever value (and thus
 triggering next validation check) isValid() on blank, required
 TextField returns true.

 Is this approach incorrect or am I missing something?

 Best regards,
 Michal Wegrzyn


 -
 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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



RE: AjaxFormComponentUpdatingBehavior, required fields and validation

2012-01-03 Thread Michal Wegrzyn
Hi Sven,

When event is triggered I check all components with #isValid().
I am not sure if validation is performed after every ajax update or only after 
submit?

I am aware of AjaxFormSubmitBehavior, but I want to check fields after every 
user action, so user can know error immediately and not only after submit.

Best regards,
Michal

 -Original Message-
 From: Sven Meier [mailto:s...@meiers.net]
 Sent: Tuesday, January 03, 2012 10:13
 To: users@wicket.apache.org
 Subject: Re: AjaxFormComponentUpdatingBehavior, required fields and
 validation
 
 Hi,
 
 are you validating all form components or just the one which triggered
 the ajax request?
 
 You know AjaxFormSubmitBehavior?
 
 Sven
 
 Am 03.01.2012 09:32, schrieb Michal Wegrzyn:
  Any ideas here? Should I provide a quickstart?
 
  Best regards,
  Michal Wegrzyn
 
  -Original Message-
  From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
  Sent: Monday, December 19, 2011 23:07
  To: users@wicket.apache.org
  Subject: AjaxFormComponentUpdatingBehavior, required fields and
  validation
 
  Hi,
 
  I have form with few TextField and DropDownChoice components. All of
  them have added AjaxFormComponentUpdatingBehavior( onkeyup ) and
 are
  set as required. Some of them are wrapped in my custom objects, but
 it
  does not matter (validation and processing logic is in behavior).
 
  With this setup after every ajax update triggered with behaviour's
  onUpdate( AjaxRequestTarget ) or onError( AjaxRequestTarget ) I try
 to
  check if form components are valid and give instant feedback to
 user.
 
  Unfortunately results obtained from component's isValid() are wrong.
  Empty TextFields are almost always valid.
  Only after clearing TextField error is added to component, but after
  changing for example other TextField to whatever value (and thus
  triggering next validation check) isValid() on blank, required
  TextField returns true.
 
  Is this approach incorrect or am I missing something?
 
  Best regards,
  Michal Wegrzyn
 
 
  -
  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


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



Re: AjaxFormComponentUpdatingBehavior, required fields and validation

2012-01-03 Thread Sven Meier

AjaxFormComponentUpdatingBehavior processes a single component only (change 
input, validate, convert), so it doesn't make sense to validate all components.
In that case you should use AjaxFormSubmitBehavior, which processes the whole 
form.

Sven


Am 03.01.2012 10:26, schrieb Michal Wegrzyn:

Hi Sven,

When event is triggered I check all components with #isValid().
I am not sure if validation is performed after every ajax update or only after 
submit?

I am aware of AjaxFormSubmitBehavior, but I want to check fields after every 
user action, so user can know error immediately and not only after submit.

Best regards,
Michal


-Original Message-
From: Sven Meier [mailto:s...@meiers.net]
Sent: Tuesday, January 03, 2012 10:13
To: users@wicket.apache.org
Subject: Re: AjaxFormComponentUpdatingBehavior, required fields and
validation

Hi,

are you validating all form components or just the one which triggered
the ajax request?

You know AjaxFormSubmitBehavior?

Sven

Am 03.01.2012 09:32, schrieb Michal Wegrzyn:

Any ideas here? Should I provide a quickstart?

Best regards,
Michal Wegrzyn


-Original Message-
From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
Sent: Monday, December 19, 2011 23:07
To: users@wicket.apache.org
Subject: AjaxFormComponentUpdatingBehavior, required fields and
validation

Hi,

I have form with few TextField and DropDownChoice components. All of
them have added AjaxFormComponentUpdatingBehavior( onkeyup ) and

are

set as required. Some of them are wrapped in my custom objects, but

it

does not matter (validation and processing logic is in behavior).

With this setup after every ajax update triggered with behaviour's
onUpdate( AjaxRequestTarget ) or onError( AjaxRequestTarget ) I try

to

check if form components are valid and give instant feedback to

user.

Unfortunately results obtained from component's isValid() are wrong.
Empty TextFields are almost always valid.
Only after clearing TextField error is added to component, but after
changing for example other TextField to whatever value (and thus
triggering next validation check) isValid() on blank, required
TextField returns true.

Is this approach incorrect or am I missing something?

Best regards,
Michal Wegrzyn


-
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


-
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



Re: Altering TextField content from within AbstractDefaultAjaxBehavior

2012-01-03 Thread Martin Grigorov
Hi,

Take a look at Wicket Ajax Debug window. Maybe there is some
JavaScript error during the replacement of the DOM node for this
textfield.
Otherwise all looks OK to me.

On Tue, Jan 3, 2012 at 3:46 PM, HugoSilva alisonsilva...@gmail.com wrote:
 Hello guys,

 I'm new to Wicket and working with it's version 1.4.9.
 I'm developing some portlets using wicket for LifeRay and sometimes using
 it's infrastructure to make inter portlets communication.
 I have a product list portlet (which only lists the products - I will call
 it portlet A) and a product creation/altering portlet which I will call
 portlet B from now on.
 When the user wants to alter a produtct, he clicks in the product in the
 portlet A and the product ID is sent to the portlet B via JavaScript using
 LifeRay's infrastructure.

 In the portlet B, I have a wicket page (extends WebPage) that in its
 constructor adds an AbstractDefaultAjaxBehavior just like the following:


                final AbstractDefaultAjaxBehavior editMessageReceiver = new
 AbstractDefaultAjaxBehavior() {

                        @Override
                        public void renderHead(IHeaderResponse response) {
                                super.renderHead(response);

                                //LifeRay's stuff
                                String strJS = Liferay.on( +
                                           'alteracao_imovel', +
                                           function(event, data) { +
                                             var imovelId = data; +
                                             if (imovelId) {+
                                               jQuery.ajax( { +
                                           url: ' + getCallbackUrl() +', + 
 // call back url
                                           data: { imovelId: imovelId }} + 
 //product id
                                           );  +
                                             } +
                                           } +
                                         );;

                                response.renderJavascript(strJS, null);
                        }

                        @Override
                        protected void respond(AjaxRequestTarget target) {
                                //recover the product id
                                String imovelId =
 RequestCycle.get().getRequest().getParameter(imovelId);

                                // retrieve the product from the database
                                produto = 
 recuperaProdutoDetalhadoPorId(Long.valueOf(imovelId));

                                //TextField in which the product name suppose 
 to go
                                TextField apres =
 (TextField)target.getPage().get(formManterImovel:apresentacao);
                                apres.setModelObject(produto.getNome());
                                apres.modelChanged();
                                target.addComponent(apres);
                        }
                };
                add(editMessageReceiver);

 Note that in the renderHead method, I add a LifeRays specifc JavaScript
 which listens to a message channel. When a message is get from the channel,
 the JavaScript calls the getCallBack() url passing the product id as a
 parameter.

 In the respond(AjaxRequestTarget target) method, I get the product id from
 the request and retrieve the product from the database to put its name in a
 TextField and show it again in the portlet B now with the products name. So
 far, so good.

 The problem is that the text field is not being repainted and ramains empty
 (without the products name in it).

 I observed that in the AjaxRequestTarget respond(final RequestCycle
 requestCycle) method, the response object carries the following message:

 ?xml version=1.0 encoding=UTF-8?
 ajax-response
    component id=txtApresentacaoId 
    [CDATA[input name=apresentacao type=text style=width: 98%;
 padding-left: 5px title=Texto de apresentação do imóvel
        value=Apartamento em localização privilegiada e ótimo acabamento
 id=txtApresentacaoId/]]
    /component
 /ajax-response

 Which have the product desired name in it. But, at the end of the request,
 the TextField is not being rendered!

 In this same portlet (portlet B) I have a combobox that changes lots of
 TextFields value through AjaxFormComponentUpdatingBehavior when the user
 changes its value. All of them are rendered again in the portlet as
 expected!

 So I dont think its a LifeRay problem at all.

 Do you guys have an idea of what is happening?

 thanks a lot

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Altering-TextField-content-from-within-AbstractDefaultAjaxBehavior-tp4256806p4256806.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: 

StringResourceModels doesn't seem to detach properly

2012-01-03 Thread Einar Bjerve
If a StringResourceModel contains a model for property substitutions, and there 
has not been assigned a component it is relative to on construction time, it 
will not detach the property substitution model.

If there is assigned a component on construction time, the property 
substitution model is detached with the StringResourceModel.

This behavior seems kind of inconsistent to me. Is this intended and correct?


Best regards
Einar Bjerve


Re: StringResourceModels doesn't seem to detach properly

2012-01-03 Thread Martin Grigorov
Hi,

It is intended.
IModel#detach() is called only if this model is assigned to a component.
Since no one calls #detach() on the StringResourceModel it has no idea
when to call detach() on its inner model.
You need to call SRM.detach() in #onDetach() in the component where it
is used. Then it will detach its inner model too.

On Tue, Jan 3, 2012 at 5:30 PM, Einar Bjerve einar.bje...@visma.no wrote:
 If a StringResourceModel contains a model for property substitutions, and 
 there has not been assigned a component it is relative to on construction 
 time, it will not detach the property substitution model.

 If there is assigned a component on construction time, the property 
 substitution model is detached with the StringResourceModel.

 This behavior seems kind of inconsistent to me. Is this intended and correct?


 Best regards
 Einar Bjerve



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Altering TextField content from within AbstractDefaultAjaxBehavior

2012-01-03 Thread HugoSilva
Thank you Martin,

I have just done what you said. It doesnt show anything in the debug window.
It remains blank!
By the other hand, when a change the combo box value it shows the ajax
command!

It means that the command is not being executed, right?
Is there something that I can do to force its execution?

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Altering-TextField-content-from-within-AbstractDefaultAjaxBehavior-tp4256806p4257762.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



Re: Altering TextField content from within AbstractDefaultAjaxBehavior

2012-01-03 Thread HugoSilva
I solved the issue

Instead of a direct call to jQuery.ajax(), I called wicketAjaxGet()
function.
I think that wicket has to do some stuff beforehand and when you call
wicketAjaxGet() it is forced to do it.

Thanks a lot

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Altering-TextField-content-from-within-AbstractDefaultAjaxBehavior-tp4256806p4258080.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



Re: Hide page version query parameters

2012-01-03 Thread Taneli Korri
On Tue, Jan 3, 2012 at 1:20 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 add the nofollow attribute to such links.


All the links had it from the start. The crawlers from the big
companies (Google, Bing etc) obey it, but some smaller ones do not.

Anyways, I fixed the problem by filtering the bad parameters with
urlrewritefilter. So no more internal server errors.

Regards,
Taneli Korri

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



Re: signOut and port

2012-01-03 Thread Jeremy Thomerson
On Mon, Jan 2, 2012 at 5:38 PM, brettTi bret...@hotmail.com wrote:

 We're running a wicket app on jetty and having an issue with signout. The
 app
 runs on port 8443 and we have iptables redirecting from port 443.  This
 lets
 us go to https://ourap.lab without port numbers and without having the web
 app run as root.

 Everything is great until we do signout.  We have a LogoutPage that does
 this:

   AuthenticatedWebSession.get().signOut();
   setResponsePage(HomePage.class);

 Works fine, we get sent to the Login page.  Only problem is that the url
 has
 the :8443 port number in it.  For some reason, this is the end of the world
 for our users.

 Any ideas?  Thanks


Maybe a combination of these two things:

First, do the iptables packet redirection [1] - sounds like you have this
working.
Then, tell Wicket what port to send redirects to [2] - sounds like this may
fix your problem.

[1] http://wiki.eclipse.org/Jetty/Howto/Port80#Using_iptables
[2]
http://www.petrikainulainen.net/programming/tips-and-tricks/wicket-https-tutorial-part-one-creating-secure-webpages/


-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


Wicket on Google App Engine

2012-01-03 Thread Daniel Watrous
Hi,

I've been working for a few days to get a wicket application going for
Google App Engine with mixed results. I hope these questions aren't
too noobie for this list?

There are a couple of really old articles which Google brings up first:
http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html
http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/

I've also found this resource after digging through the wicket users
list, but I can't figure out how I'm supposed to use it:
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent

I'm using eclipse with the GAE plugin.

So far this is what I have accomplished.
1) the first link above provides a download demo as an eclipse
project. I can get this to run, but it's working with old versions
(wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated.
2) I can create a new google app engine project in eclipse. It runs
fine and I can develop servlets.
3) I can user the maven build script from the quickstart to get a
functional wicket project.

I'm really struggling trying to figure out how to use the
gae-initializer or a base GAE project from eclipse and end up with a
functional wicket application...

I'm not sure what other information to include at this point. Please
share any pointers or links to other tutorials that might help me.

Daniel

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



Re: Wicket on Google App Engine

2012-01-03 Thread Martin Grigorov
Hi,

gae-initializer project provides
https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java
which is an implementation of org.apache.wicket.IInitializer and declares it in
https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties.
That means that when gae-initializer.jar is in the classpath Wicket
will use it to initialize the Application instance.
Check the source of GaeInitializer.jar to see what exactly it configures.

On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrous daniel.watr...@gmail.com wrote:
 Hi,

 I've been working for a few days to get a wicket application going for
 Google App Engine with mixed results. I hope these questions aren't
 too noobie for this list?

 There are a couple of really old articles which Google brings up first:
 http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html
 http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/

 I've also found this resource after digging through the wicket users
 list, but I can't figure out how I'm supposed to use it:
 https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent

 I'm using eclipse with the GAE plugin.

 So far this is what I have accomplished.
 1) the first link above provides a download demo as an eclipse
 project. I can get this to run, but it's working with old versions
 (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated.
 2) I can create a new google app engine project in eclipse. It runs
 fine and I can develop servlets.
 3) I can user the maven build script from the quickstart to get a
 functional wicket project.

 I'm really struggling trying to figure out how to use the
 gae-initializer or a base GAE project from eclipse and end up with a
 functional wicket application...

 I'm not sure what other information to include at this point. Please
 share any pointers or links to other tutorials that might help me.

 Daniel

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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