You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by antechrestos <an...@yahoo.fr> on 2012/10/03 10:58:03 UTC

Reseting a textField of an upload form

Hello,

I have an upload form with a TextField and a FileUploadField. When the user
fill the form and press an AjaxButton, it refreshes the RefreshingView
listing the files already uploaded.
What I would like to do is clear the textfield when the form is submitted.
I already tried to add the text field in the AjaxRequestTarget of the
submitting button after having cleared the model object. Apparently it works
but when I try to submit a new time, it keeps sending null value in my model
object.
I also tried to update the model object by adding a
AjaxFormComponentUpdatingBehavior to the TextField and update the model
object from there: I see the new value entered, but when the user presses
the submit button, it keeps sending me null....
I must be missing a things but I am totally lost :(




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-upload-form-tp4652632.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Reseting a textField of an upload form

Posted by Sébastien Gautrin <se...@gmail.com>.
You can actually put the wicket namespace for child pages and 
components, wicket will only use for its rendering what's inside 
<wicket:extends> for the child pages, and what's inside <wicket:panel> 
for your panels (as well as what's in <wicket:head> for header 
contributions).

antechrestos wrote:
> Well it works fine!
> I will look for a good plugin for editing markups...
> I use page inheritance . Hence adding the wicket namespace only works for my
> mother page :'(
> Anyway thank you both :)
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-upload-form-tp4652632p4652680.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


RE: Reseting a textField of an upload form

Posted by antechrestos <an...@yahoo.fr>.
Well it works fine!
I will look for a good plugin for editing markups...
I use page inheritance . Hence adding the wicket namespace only works for my
mother page :'(
Anyway thank you both :)



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-upload-form-tp4652632p4652680.html
Sent from the Users forum mailing list archive at Nabble.com.

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


RE: Reseting a textField of an upload form

Posted by Paul Bors <pa...@bors.ws>.
Also when in DEVELOPMENT mode have Wicket validate your HTML similar to:
http://wicketinaction.com/2009/06/wicket-html-validator-12/

~ Thank you,
  Paul Bors

-----Original Message-----
From: Paul Bors [mailto:paul@bors.ws] 
Sent: Thursday, October 04, 2012 12:06 PM
To: users@wicket.apache.org
Subject: RE: Reseting a textField of an upload form

Ouch! Invalid HTML :(

I would advise you always let Eclipse check the syntax of the HTML given:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">

~ Thank you,
  Paul Bors

-----Original Message-----
From: Andrea Del Bene [mailto:an.delbene@gmail.com]
Sent: Thursday, October 04, 2012 10:54 AM
To: users@wicket.apache.org
Subject: Re: Reseting a textField of an upload form

The problem seems related to the HTML. I've tried to put the table inside
the form and it works. Like this:

<form wicket:id="uploadForm">
             <table wicket:id="formContainer">
             <tr>
<th><label>[filename]</label></th>
<th><label>[fileupload]</label></th>
                 <th/>
             </tr>
             <tr>
                 <td><input wicket:id="fileName" type="text"/></td>
                 <td><input wicket:id="fileInput" type="file"/></td>
                 <td><input wicket:id="submit" class="submit_button" 
type="submit" value="add"/></td>
             </tr>
             </table>
         </form>


> Home.java
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.java>
> Home.html
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.html>
> @Paul: Yeah I already checked these examples.
>
> @Andrea: You may find my page and markup attached to the post
>
> When I run it I fill the form a first time, when I click on submit the 
> text field is cleared and I see in the log:
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit 
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileName=Test1 [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileInput==null?=false
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : got 9418 
> bytes [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> onSubmit [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> fileName=Test1 [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> fileInput==null?=false
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : Got 9418 
> bytes [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : model 
> cleaned So it is ok....But when I fill the form another time I get:
>
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit 
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileName=null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileInput==null?=true
> [10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] ajax : fileInput 
> is null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> onSubmit [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> fileName=null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> fileInput==null?=true
> [10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] form : fileInput 
> is null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> model cleaned
>
> Nothing is transmitted :(
>
> Thank you
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-
> upload-form-tp4652632p4652653.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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




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


RE: Reseting a textField of an upload form

Posted by Paul Bors <pa...@bors.ws>.
Ouch! Invalid HTML :(

I would advise you always let Eclipse check the syntax of the HTML given:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">

~ Thank you,
  Paul Bors

-----Original Message-----
From: Andrea Del Bene [mailto:an.delbene@gmail.com] 
Sent: Thursday, October 04, 2012 10:54 AM
To: users@wicket.apache.org
Subject: Re: Reseting a textField of an upload form

The problem seems related to the HTML. I've tried to put the table inside
the form and it works. Like this:

<form wicket:id="uploadForm">
             <table wicket:id="formContainer">
             <tr>
<th><label>[filename]</label></th>
<th><label>[fileupload]</label></th>
                 <th/>
             </tr>
             <tr>
                 <td><input wicket:id="fileName" type="text"/></td>
                 <td><input wicket:id="fileInput" type="file"/></td>
                 <td><input wicket:id="submit" class="submit_button" 
type="submit" value="add"/></td>
             </tr>
             </table>
         </form>


> Home.java
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.java>
> Home.html
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.html>
> @Paul: Yeah I already checked these examples.
>
> @Andrea: You may find my page and markup attached to the post
>
> When I run it I fill the form a first time, when I click on submit the 
> text field is cleared and I see in the log:
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit 
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : 
> fileName=Test1 [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileInput==null?=false
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : got 9418 
> bytes [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> onSubmit [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> fileName=Test1 [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> fileInput==null?=false
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : Got 9418 
> bytes [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : model 
> cleaned So it is ok....But when I fill the form another time I get:
>
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit 
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : 
> fileName=null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileInput==null?=true
> [10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] ajax : fileInput 
> is null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> onSubmit [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> fileName=null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> fileInput==null?=true
> [10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] form : fileInput 
> is null [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : 
> model cleaned
>
> Nothing is transmitted :(
>
> Thank you
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-
> upload-form-tp4652632p4652653.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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



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


Re: Reseting a textField of an upload form

Posted by Andrea Del Bene <an...@gmail.com>.
The problem seems related to the HTML. I've tried to put the table 
inside the form and it works. Like this:

<form wicket:id="uploadForm">
             <table wicket:id="formContainer">
             <tr>
<th><label>[filename]</label></th>
<th><label>[fileupload]</label></th>
                 <th/>
             </tr>
             <tr>
                 <td><input wicket:id="fileName" type="text"/></td>
                 <td><input wicket:id="fileInput" type="file"/></td>
                 <td><input wicket:id="submit" class="submit_button" 
type="submit" value="add"/></td>
             </tr>
             </table>
         </form>


> Home.java
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.java>
> Home.html
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.html>
> @Paul: Yeah I already checked these examples.
>
> @Andrea: You may find my page and markup attached to the post
>
> When I run it I fill the form a first time, when I click on submit the text
> field is cleared and I see in the log:
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : fileName=Test1
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileInput==null?=false
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : got 9418 bytes
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : onSubmit
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : fileName=Test1
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> fileInput==null?=false
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : Got 9418 bytes
> [10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : model cleaned
> So it is ok....But when I fill the form another time I get:
>
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : fileName=null
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
> fileInput==null?=true
> [10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] ajax : fileInput is null
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : onSubmit
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : fileName=null
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
> fileInput==null?=true
> [10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] form : fileInput is null
> [10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : model cleaned
>
> Nothing is transmitted :(
>
> Thank you
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-upload-form-tp4652632p4652653.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


RE: Reseting a textField of an upload form

Posted by antechrestos <an...@yahoo.fr>.
Home.java
<http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.java>  
Home.html
<http://apache-wicket.1842946.n4.nabble.com/file/n4652653/Home.html>  
@Paul: Yeah I already checked these examples.

@Andrea: You may find my page and markup attached to the post

When I run it I fill the form a first time, when I click on submit the text
field is cleared and I see in the log:
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : fileName=Test1
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
fileInput==null?=false
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : got 9418 bytes
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : onSubmit
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : fileName=Test1
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
fileInput==null?=false
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : Got 9418 bytes
[10:49:04] [DEBUG] [15485575@qtp-22725577-0] [Home] form : model cleaned
So it is ok....But when I fill the form another time I get:

[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : onSubmit
[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax : fileName=null
[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] ajax :
fileInput==null?=true
[10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] ajax : fileInput is null
[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : onSubmit
[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : fileName=null
[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form :
fileInput==null?=true
[10:49:20] [ERROR] [15485575@qtp-22725577-0] [Home] form : fileInput is null
[10:49:20] [DEBUG] [15485575@qtp-22725577-0] [Home] form : model cleaned

Nothing is transmitted :(

Thank you




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-upload-form-tp4652632p4652653.html
Sent from the Users forum mailing list archive at Nabble.com.

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


RE: Reseting a textField of an upload form

Posted by Paul Bors <pa...@bors.ws>.
I would also suggest getting familiar with Wicket's home page and making use
of the Live example from under the Learn left navigation section:
http://wicket.apache.org/learn/examples/

follow the examples Wicket has at:
http://www.wicket-library.com/wicket-examples/index.html

Start from the component examples at:
http://www.wicket-library.com/wicket-examples/compref/

Or the Ajax ones:
http://www.wicket-library.com/wicket-examples/ajax/

More precisely the one on File Upload via Ajax:
http://www.wicket-library.com/wicket-examples/ajax/upload

And take a look at its source code:
http://www.wicket-library.com/wicket-examples/ajax/wicket/bookmarkable/org.a
pache.wicket.examples.source.SourcesPage;jsessionid=CD0504C6E5FC8905084418BD
3FCF45A0?0&SourcesPage_class=org.apache.wicket.examples.ajax.builtin.Index&s
ource=FileUploadPage.java

~ Thank you,
  Paul Bors

-----Original Message-----
From: Andrea Del Bene [mailto:an.delbene@gmail.com] 
Sent: Wednesday, October 03, 2012 4:34 PM
To: users@wicket.apache.org
Subject: Re: Reseting a textField of an upload form

Hi,

can you show the code you use to clear the model object of the textfield?
> Hello,
>
> I have an upload form with a TextField and a FileUploadField. When the 
> user fill the form and press an AjaxButton, it refreshes the 
> RefreshingView listing the files already uploaded.
> What I would like to do is clear the textfield when the form is submitted.
> I already tried to add the text field in the AjaxRequestTarget of the 
> submitting button after having cleared the model object. Apparently it 
> works but when I try to submit a new time, it keeps sending null value 
> in my model object.
> I also tried to update the model object by adding a 
> AjaxFormComponentUpdatingBehavior to the TextField and update the 
> model object from there: I see the new value entered, but when the 
> user presses the submit button, it keeps sending me null....
> I must be missing a things but I am totally lost :(
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-
> upload-form-tp4652632.html Sent from the Users forum mailing list 
> archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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



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


Re: Reseting a textField of an upload form

Posted by Andrea Del Bene <an...@gmail.com>.
Hi,

can you show the code you use to clear the model object of the textfield?
> Hello,
>
> I have an upload form with a TextField and a FileUploadField. When the user
> fill the form and press an AjaxButton, it refreshes the RefreshingView
> listing the files already uploaded.
> What I would like to do is clear the textfield when the form is submitted.
> I already tried to add the text field in the AjaxRequestTarget of the
> submitting button after having cleared the model object. Apparently it works
> but when I try to submit a new time, it keeps sending null value in my model
> object.
> I also tried to update the model object by adding a
> AjaxFormComponentUpdatingBehavior to the TextField and update the model
> object from there: I see the new value entered, but when the user presses
> the submit button, it keeps sending me null....
> I must be missing a things but I am totally lost :(
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Reseting-a-textField-of-an-upload-form-tp4652632.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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