You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ma...@mail.bg on 2011/09/02 17:50:02 UTC

Ultra strange behaviour AjaxButton - Form



Hello, guys, 


I'm experiencing some very strange problem - an AjaxButton's onSubmit never
gets called. 


Here are snippets of what I have: 


HTML: 


... some fields...


in code: 


Form form = new Form("form"); 


AjaxButton submitButton = new AjaxButton("submit") { 


public void onSubmit(ART target, Form form) { 


System.out.println("clicked"); // never printed


... some logic ...  


} 


}; 


form.add(submitButton); 


add(form); 


The above statement and logic are never reached.
The Ajax debugger prints nothing. 


Any help is appreciated. 


Thanks,
Martin 

-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

RE: Ultra strange behaviour AjaxButton - Form

Posted by ma...@mail.bg.
Sorry, HTML is:

<form wicket:id="form">

... some fields...

<input type="submit" wicket:id="submit" class="some_class" />

</form>




----- Цитат от martin.asenov@mail.bg, на 02.09.2011 в 18:50 -----



Hello, guys, 


I'm experiencing some very strange problem - an AjaxButton's onSubmit never
gets called. 


Here are snippets of what I have: 


HTML: 


... some fields...


in code: 


Form form = new Form("form"); 


AjaxButton submitButton = new AjaxButton("submit") { 


public void onSubmit(ART target, Form form) { 


System.out.println("clicked"); // never printed


... some logic ... 


} 


}; 


form.add(submitButton); 


add(form); 


The above statement and logic are never reached.
The Ajax debugger prints nothing. 


Any help is appreciated. 


Thanks,
Martin 

-------------------------------------



-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

Re: Know if FileUploadField has value set before its parent form is submitted and file gets uploaded

Posted by Martin Grigorov <mg...@apache.org>.
Check https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/wicket-html5-parent/wicket-html5/src/main/java/org/wicketstuff/html5/fileapi
and its examples. But this uses HTML5 APIs and wont work on your
favorite Internet Explorer.

On Sun, Sep 4, 2011 at 7:35 PM, Christian Huber <hu...@butterbrot.org> wrote:
> Not sure if I completely understand what you want to do but as far as I do I
> guess the only way to do that is using java script.
>
> You could add a java script validation routine to the submit buttons onclick
> handler that aborts submission when the input field has no value.
>
> Another approach could be to add a onchange handler for the input field. If
> the field has a value set after a change the submit button gets enabled
> otherwise it can be disabled.
>
> hth, Chris
>
>
> The Sanity Resort <http://sanityresort.blogspot.com/>
>
> Am 04.09.2011 15:47, schrieb martin.asenov@mail.bg:
>>
>>
>> Hello, guys,
>>
>>
>> I've got a FileUploadField as so:
>>
>>
>>  image1UploadField = new FileUploadField("image1_upload", new Model());
>>
>>
>> I aim to know if the field has value set even before the form gets
>> processed and the item gets uploaded. I want to minimize traffic and
>> memory
>> usage of my application. Therefore I don't want the file get uploaded
>> before I know if there really was file specified.
>>
>>
>> What's the most proper way to do this in Wicket code?
>>
>>
>> Thank you in advance,
>> Martin
>>
>> -------------------------------------
>> Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския
>> пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна
>> версия, SMS известяване и други.
>



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

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


Re: Know if FileUploadField has value set before its parent form is submitted and file gets uploaded

Posted by Christian Huber <hu...@butterbrot.org>.
Not sure if I completely understand what you want to do but as far as I 
do I guess the only way to do that is using java script.

You could add a java script validation routine to the submit buttons 
onclick handler that aborts submission when the input field has no value.

Another approach could be to add a onchange handler for the input field. 
If the field has a value set after a change the submit button gets 
enabled otherwise it can be disabled.

hth, Chris


The Sanity Resort <http://sanityresort.blogspot.com/>

Am 04.09.2011 15:47, schrieb martin.asenov@mail.bg:
>
>
> Hello, guys,
>
>
> I've got a FileUploadField as so:
>
>
>   image1UploadField = new FileUploadField("image1_upload", new Model());
>
>
> I aim to know if the field has value set even before the form gets
> processed and the item gets uploaded. I want to minimize traffic and memory
> usage of my application. Therefore I don't want the file get uploaded
> before I know if there really was file specified.
>
>
> What's the most proper way to do this in Wicket code?
>
>
> Thank you in advance,
> Martin
>
> -------------------------------------
> Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

Know if FileUploadField has value set before its parent form is submitted and file gets uploaded

Posted by ma...@mail.bg.


Hello, guys, 


I've got a FileUploadField as so: 


 image1UploadField = new FileUploadField("image1_upload", new Model()); 


I aim to know if the field has value set even before the form gets
processed and the item gets uploaded. I want to minimize traffic and memory
usage of my application. Therefore I don't want the file get uploaded
before I know if there really was file specified. 


What's the most proper way to do this in Wicket code? 


Thank you in advance,
Martin 

-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

Re: Ultra strange behaviour AjaxButton - Form

Posted by ma...@mail.bg.


Thanks, Clint. I found that I had overriden the validate() method of one of
the textfields. Shame on me :) 


Best regards,
Martin  


----- Цитат от Clint Checketts (checketts@gmail.com), на
04.09.2011 в 15:21 -----   Are you using a custom object? A converter
could be failing to do the
conversion. As in you have a 'User' object tied to your field and Wicket
doesn't know by default how to convert the text 'Bob' into a new User
object.


On Fri, Sep 2, 2011 at 11:02 AM,  wrote:


Thanks, this is the case.


However, I've no idea why the form does validation, since I have no
required fields in it, nor have specified any validator.


Best regards,
Martin


----- Цитат от Ernesto Reinaldo Barreiro (reiern70@gmail.com), на
02.09.2011 в 18:55 ----- maybe you have validation errors and in that
case onError will be
called instead.


Regards,


Ernesto


On Fri, Sep 2, 2011 at 5:50 PM, wrote:


Hello, guys,


I'm experiencing some very strange problem - an AjaxButton's onSubmit
never
gets called.


Here are snippets of what I have:


HTML:


... some fields...


in code:


Form form = new Form("form");


AjaxButton submitButton = new AjaxButton("submit") {


public void onSubmit(ART target, Form form) {


System.out.println("clicked"); // never printed


... some logic ...


}


};


form.add(submitButton);


add(form);


The above statement and logic are never reached.
The Ajax debugger prints nothing.


Any help is appreciated.


Thanks,
Martin


-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите
характеристики на българския пазар - 10 GB
пощенска кутия, 20 MB прикрепен файл,
безплатен POP3, мобилна версия, SMS
известяване и други.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите
характеристики на българския
пазар - 10 GB пощенска кутия, 20 MB прикрепен
файл, безплатен POP3, мобилна
версия, SMS известяване и други.


 

-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

Re: Ultra strange behaviour AjaxButton - Form

Posted by Clint Checketts <ch...@gmail.com>.
Are you using a custom object? A converter could be failing to do the
conversion. As in you have a 'User' object tied to your field and Wicket
doesn't know by default how to convert the text 'Bob' into a new User
object.

On Fri, Sep 2, 2011 at 11:02 AM, <ma...@mail.bg> wrote:

>
>
>
> Thanks, this is the case.
>
>
> However, I've no idea why the form does validation, since I have no
> required fields in it, nor have specified any validator.
>
>
> Best regards,
> Martin
>
>
> ----- Цитат от Ernesto Reinaldo Barreiro (reiern70@gmail.com), на
> 02.09.2011 в 18:55 -----   maybe you have validation errors and in that
> case onError will be
> called instead.
>
>
> Regards,
>
>
> Ernesto
>
>
> On Fri, Sep 2, 2011 at 5:50 PM,  wrote:
>
>
> Hello, guys,
>
>
> I'm experiencing some very strange problem - an AjaxButton's onSubmit
> never
> gets called.
>
>
> Here are snippets of what I have:
>
>
> HTML:
>
>
> ... some fields...
>
>
> in code:
>
>
> Form form = new Form("form");
>
>
> AjaxButton submitButton = new AjaxButton("submit") {
>
>
> public void onSubmit(ART target, Form form) {
>
>
> System.out.println("clicked"); // never printed
>
>
> ... some logic ...
>
>
> }
>
>
> };
>
>
> form.add(submitButton);
>
>
> add(form);
>
>
> The above statement and logic are never reached.
> The Ajax debugger prints nothing.
>
>
> Any help is appreciated.
>
>
> Thanks,
> Martin
>
>
> -------------------------------------
> Mail.bg: Безплатен e-mail адрес. Най-добрите
> характеристики на българския пазар - 10 GB
> пощенска кутия, 20 MB прикрепен файл,
> безплатен POP3, мобилна версия, SMS
> известяване и други.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> -------------------------------------
> Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския
> пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна
> версия, SMS известяване и други.
>

Re: Ultra strange behaviour AjaxButton - Form

Posted by ma...@mail.bg.


Thanks, this is the case. 


However, I've no idea why the form does validation, since I have no
required fields in it, nor have specified any validator. 


Best regards,
Martin  


----- Цитат от Ernesto Reinaldo Barreiro (reiern70@gmail.com), на
02.09.2011 в 18:55 -----   maybe you have validation errors and in that
case onError will be
called instead.


Regards,


Ernesto


On Fri, Sep 2, 2011 at 5:50 PM,  wrote:


Hello, guys,


I'm experiencing some very strange problem - an AjaxButton's onSubmit
never
gets called.


Here are snippets of what I have:


HTML:


... some fields...


in code:


Form form = new Form("form");


AjaxButton submitButton = new AjaxButton("submit") {


public void onSubmit(ART target, Form form) {


System.out.println("clicked"); // never printed


... some logic ...


}


};


form.add(submitButton);


add(form);


The above statement and logic are never reached.
The Ajax debugger prints nothing.


Any help is appreciated.


Thanks,
Martin


-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите
характеристики на българския пазар - 10 GB
пощенска кутия, 20 MB прикрепен файл,
безплатен POP3, мобилна версия, SMS
известяване и други.   
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


 

-------------------------------------
Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

Re: Ultra strange behaviour AjaxButton - Form

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
maybe you have validation errors and in that case onError will be
called instead.

Regards,

Ernesto

On Fri, Sep 2, 2011 at 5:50 PM,  <ma...@mail.bg> wrote:
>
>
>
> Hello, guys,
>
>
> I'm experiencing some very strange problem - an AjaxButton's onSubmit never
> gets called.
>
>
> Here are snippets of what I have:
>
>
> HTML:
>
>
> ... some fields...
>
>
> in code:
>
>
> Form form = new Form("form");
>
>
> AjaxButton submitButton = new AjaxButton("submit") {
>
>
> public void onSubmit(ART target, Form form) {
>
>
> System.out.println("clicked"); // never printed
>
>
> ... some logic ...
>
>
> }
>
>
> };
>
>
> form.add(submitButton);
>
>
> add(form);
>
>
> The above statement and logic are never reached.
> The Ajax debugger prints nothing.
>
>
> Any help is appreciated.
>
>
> Thanks,
> Martin
>
> -------------------------------------
> Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар - 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, SMS известяване и други.

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