Re: AjaxLink cannot see updated model values

2016-10-13 Thread Iamuser
I have added
txtName.setOutputMarkupId(true);
and
target.add(TestForm.this);

But it is still not working.

txtName.setOutputMarkupId(true);
AjaxLink clearLink = new AjaxLink("clearLink", model)
{
/**
*
*/
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
model.setObject(new TestBean());
TestForm.this.clearInput();
target.add(TestForm.this);
}

};

On Thu, Oct 13, 2016 at 4:52 PM, Martin Grigorov-4 [via Apache Wicket] <
ml-node+s1842946n4675763...@n4.nabble.com> wrote:

> On Thu, Oct 13, 2016 at 3:38 PM, Iamuser <[hidden email]
> <http:///user/SendEmail.jtp?type=node=4675763=0>> wrote:
>
> > Hello,
> >
> > Yes, adding the behavoiur AjaxFormComponentUpdatingBehavior on the text
> > field, solved the issue.
> >
> > Thank you for solution.
> >
> > Now I'm facing following situation.
> > When another link is clicked I need to clear the input fields (so my
> > textfield).
> >
> > I have the following added, but the form just doesn't get cleared.
> > The model is empty, but the page still remains with the text, even after
> > page refresh.
> > Could you please advise?
> >
> >
> > AjaxLink clearLink = new AjaxLink("clearLink",
> model)
> > {
> > /**
> >  *
> >  */
> > private static final long
> > serialVersionUID = 1L;
> >
> > @Override
> > public void
> > onClick(AjaxRequestTarget target) {
> > model.setObject(new
> > TestBean());
> >
> TestForm.this.clearInput();
> >
>
> target.add(TestForm.this);
>
>
> > }
> >
> > };
> >
> > add(clearLink);
> >
> > PS: I hope I have subscribed to the mailing list. I have sent an email
> to
> > users-allow-subscribe
> >
>
> http://wicket.apache.org/help/email.html#user
> Follow the links.
> Once subscribed just send messages to [hidden email]
> <http:///user/SendEmail.jtp?type=node=4675763=1>. Do not use
> Nabble!
>
>
> >
> >
> > Thank you
> >
> >
> > --
> > View this message in context: http://apache-wicket.1842946.
> > n4.nabble.com/AjaxLink-cannot-see-updated-model-values-
> > tp4675743p4675761.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > -----------------
> > To unsubscribe, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node=4675763=2>
> > For additional commands, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node=4675763=3>
> >
> >
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-wicket.1842946.n4.nabble.com/AjaxLink-cannot-
> see-updated-model-values-tp4675743p4675763.html
> To unsubscribe from AjaxLink cannot see updated model values, click here
> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=4675743=c3VwZXJiaXNzaW1hQGdtYWlsLmNvbXw0Njc1NzQzfC01MzM2MjU4NzI=>
> .
> NAML
> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLink-cannot-see-updated-model-values-tp4675743p4675764.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: AjaxLink cannot see updated model values

2016-10-13 Thread Martin Grigorov
On Thu, Oct 13, 2016 at 3:38 PM, Iamuser <superbiss...@gmail.com> wrote:

> Hello,
>
> Yes, adding the behavoiur AjaxFormComponentUpdatingBehavior on the text
> field, solved the issue.
>
> Thank you for solution.
>
> Now I'm facing following situation.
> When another link is clicked I need to clear the input fields (so my
> textfield).
>
> I have the following added, but the form just doesn't get cleared.
> The model is empty, but the page still remains with the text, even after
> page refresh.
> Could you please advise?
>
>
> AjaxLink clearLink = new AjaxLink("clearLink", model)
> {
> /**
>  *
>  */
> private static final long
> serialVersionUID = 1L;
>
> @Override
> public void
> onClick(AjaxRequestTarget target) {
> model.setObject(new
> TestBean());
> TestForm.this.clearInput();
>

target.add(TestForm.this);


> }
>
> };
>
> add(clearLink);
>
> PS: I hope I have subscribed to the mailing list. I have sent an email to
> users-allow-subscribe
>

http://wicket.apache.org/help/email.html#user
Follow the links.
Once subscribed just send messages to users@wicket.apache.org. Do not use
Nabble!


>
>
> Thank you
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxLink-cannot-see-updated-model-values-
> tp4675743p4675761.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: AjaxLink cannot see updated model values

2016-10-13 Thread Ernesto Reinaldo Barreiro
make

TextField txtName

a field. Call txtName.setOutputMarkupId(true) and add it to the ART on on
click

On Thu, Oct 13, 2016 at 3:38 PM, Iamuser <superbiss...@gmail.com> wrote:

> Hello,
>
> Yes, adding the behavoiur AjaxFormComponentUpdatingBehavior on the text
> field, solved the issue.
>
> Thank you for solution.
>
> Now I'm facing following situation.
> When another link is clicked I need to clear the input fields (so my
> textfield).
>
> I have the following added, but the form just doesn't get cleared.
> The model is empty, but the page still remains with the text, even after
> page refresh.
> Could you please advise?
>
>
> AjaxLink clearLink = new AjaxLink("clearLink", model)
> {
> /**
>  *
>  */
> private static final long
> serialVersionUID = 1L;
>
> @Override
> public void
> onClick(AjaxRequestTarget target) {
> model.setObject(new
> TestBean());
> TestForm.this.clearInput();
> }
>
> };
>
> add(clearLink);
>
> PS: I hope I have subscribed to the mailing list. I have sent an email to
> users-allow-subscribe
>
>
> Thank you
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxLink-cannot-see-updated-model-values-
> tp4675743p4675761.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro


Re: AjaxLink cannot see updated model values

2016-10-13 Thread Iamuser
Hello,

Yes, adding the behavoiur AjaxFormComponentUpdatingBehavior on the text
field, solved the issue.

Thank you for solution.

Now I'm facing following situation.
When another link is clicked I need to clear the input fields (so my
textfield).

I have the following added, but the form just doesn't get cleared. 
The model is empty, but the page still remains with the text, even after
page refresh.
Could you please advise?


AjaxLink clearLink = new AjaxLink("clearLink", model)
{
/**
 * 
 */
private static final long 
serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget 
target) {
model.setObject(new TestBean());
TestForm.this.clearInput();
}

};

add(clearLink);

PS: I hope I have subscribed to the mailing list. I have sent an email to 
users-allow-subscribe


Thank you


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLink-cannot-see-updated-model-values-tp4675743p4675761.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: AjaxLink cannot see updated model values

2016-10-12 Thread Ernesto Reinaldo Barreiro
Read Martin's comment: you are not submitting the form.

On Wed, Oct 12, 2016 at 5:33 PM, Iamuser <superbiss...@gmail.com> wrote:

> Hello,
>
> Yes, it is dynamic.
>
> Here is the complete code (html and java):
>
> ==My test bean==
>
> public class TestBean implements Serializable{
>
> /**
>  *
>  */
> private static final long serialVersionUID = 1L;
>
>
> private String name;
> private String code;
> private Integer id;
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public String getCode() {
> return code;
> }
> public void setCode(String code) {
> this.code = code;
> }
> public Integer getId() {
> return id;
> }
> public void setId(Integer id) {
> this.id = id;
> }
>
> }
>
> ==HTML page==
>
> 
> http://www.w3.org/1999/xhtml;
> xmlns:wicket="http://wicket.apache.org/; lang="en" xml:lang="en">
> 
> 
> 
>
>
>
>
> Name:
>
>  size="80"/>
>
>
>
>
>
>   name="btnSave" /> <#>
>
>
>
>
> 
> 
> 
> 
>
> ==JAVA code==
> public class TestPage extends Page {
>
> private static final long serialVersionUID = 311508940740808005L;
> private static final Logger logger = LogManager.getLogger(TestPage.
> class);
> private ReturnObjectPage returnPage = null;
>
> public TestPage(IModel model, final ReturnObjectPage
> returnPage)
> {
> super(model);
> this.returnPage = returnPage;
>
> add(new TestForm("testForm", model));
>
> }
>
> class TestForm extends Form {
> /**
>  *
>  */
> private static final long serialVersionUID = 1L;
>
> public TestForm(String id, IModel model) {
> super(id, model);
>
> TextField txtName = new
> TextField("txtName", new
> PropertyModel(getDefaultModel(), "name"));
> add(txtName);
>
> AjaxLink testLink = new
> AjaxLink("testLink",
> getModel())
> {
> /**
>  *
>  */
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> System.out.println("ajax in");
> System.out.println("test name= " +
> getModelObject().getName());
> }
>
> };
>
> add(testLink);
> }
> }
>
>
> }
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxLink-cannot-see-updated-model-values-
> tp4675743p4675746.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro


Re: AjaxLink cannot see updated model values

2016-10-12 Thread Iamuser
Hello,

Yes, it is dynamic.

Here is the complete code (html and java):

==My test bean==

public class TestBean implements Serializable{

/**
 * 
 */
private static final long serialVersionUID = 1L;


private String name;
private String code;
private Integer id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}

}

==HTML page==


http://www.w3.org/1999/xhtml;
xmlns:wicket="http://wicket.apache.org/; lang="en" xml:lang="en">







Name:







  <#>  









==JAVA code==
public class TestPage extends Page {

private static final long serialVersionUID = 311508940740808005L;
private static final Logger logger = 
LogManager.getLogger(TestPage.class);
private ReturnObjectPage returnPage = null;

public TestPage(IModel model, final ReturnObjectPage 
returnPage)
{
super(model);
this.returnPage = returnPage;

add(new TestForm("testForm", model));

}

class TestForm extends Form {
/**
 * 
 */
private static final long serialVersionUID = 1L;

public TestForm(String id, IModel model) {
super(id, model);

TextField txtName = new TextField("txtName", new
PropertyModel(getDefaultModel(), "name"));
add(txtName);

AjaxLink testLink = new AjaxLink("testLink",
getModel())
{
/**
 * 
 */
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("ajax in");
System.out.println("test name= " + 
getModelObject().getName());
}

};

add(testLink);
}
    }
    

}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLink-cannot-see-updated-model-values-tp4675743p4675746.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



AjaxLink cannot see updated model values

2016-10-12 Thread Iamuser
Hi,

I have a form backed by a model.
In this form I have and editable textfield and a image.

When clicking on the image I just need to write the value inserted in the
textfield to the console.

However, it does never display the updated value in the textfield.

Here is the html:
 <#>  

Here is the Java code:

AjaxLink testLink = new AjaxLink("testLink", getModel())
{
/**
 * 
 */
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("test link 1" + 
getModelObject().getName());
}
};

Could you please tell me a solution?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLink-cannot-see-updated-model-values-tp4675743.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: AjaxLink cannot see updated model values

2016-10-12 Thread Martin Grigorov
Hi,

AjaxLink uses AjaxEventBehavior behind the scenes. This behavior doesn't
send any parameters with the request.
You need something like AjaxFormComponentUpdatingBehavior to send form
elements' value to the server or use dynamic extra parameters by overriding
#updateAjaxAttributes().

P.S. Please subscribe to the mailing lists. You ask questions often and all
this moderation just slows down the delivery. Also the code snippets are
not sent by Nabble.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 12, 2016 at 5:07 PM, Iamuser <superbiss...@gmail.com> wrote:

> Hi,
>
> I have a form backed by a model.
> In this form I have and editable textfield and a image.
>
> When clicking on the image I just need to write the value inserted in the
> textfield to the console.
>
> However, it does never display the updated value in the textfield.
>
> Here is the html:
>  <#>
>
> Here is the Java code:
>
> AjaxLink testLink = new AjaxLink("testLink", getModel())
> {
> /**
>  *
>  */
> private static final long serialVersionUID
> = 1L;
>
> @Override
> public void onClick(AjaxRequestTarget
> target) {
> System.out.println("test link 1" +
> getModelObject().getName());
> }
> };
>
> Could you please tell me a solution?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxLink-cannot-see-updated-model-values-tp4675743.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: AjaxLink cannot see updated model values

2016-10-12 Thread Ernesto Reinaldo Barreiro
if you model dynamic?

On Wed, Oct 12, 2016 at 5:07 PM, Iamuser <superbiss...@gmail.com> wrote:

> Hi,
>
> I have a form backed by a model.
> In this form I have and editable textfield and a image.
>
> When clicking on the image I just need to write the value inserted in the
> textfield to the console.
>
> However, it does never display the updated value in the textfield.
>
> Here is the html:
>  <#>
>
> Here is the Java code:
>
> AjaxLink testLink = new AjaxLink("testLink", getModel())
> {
> /**
>  *
>  */
> private static final long serialVersionUID
> = 1L;
>
> @Override
> public void onClick(AjaxRequestTarget
> target) {
> System.out.println("test link 1" +
> getModelObject().getName());
> }
> };
>
> Could you please tell me a solution?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxLink-cannot-see-updated-model-values-tp4675743.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro