You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edi <ed...@yahoo.com> on 2007/12/04 11:00:00 UTC

Important concept in wicket? Please advise

Hi to all,

I want to display one label when I click one button.

I have wrote the code. but i am not able to display that message.

my code is looking like

file name : FilterPanel.java

 public final class ReportForm extends Form 
    {
        public ReportForm(String s, final Reports model) 
        {
        	super(s);
            setOutputMarkupId(true);

            PropertyModel filterPanelMsgModel = new PropertyModel(this,
"validationMessage");
    		final Label filterPanelMsgLabel = new Label("validationMsgLabel",
filterPanelMsgModel);		
    		filterPanelMsgLabel.setEscapeModelStrings(false);
    		filterPanelMsgLabel.setOutputMarkupId(true);
    		add(filterPanelMsgLabel);

    //in submit button, 
    AjaxSubmitLink saveButton = new AjaxSubmitLink("saveButton", this) 
            {
                protected void onSubmit(AjaxRequestTarget target, Form form) 
                {
                     // To display the string in html page.
                     setValidationMessage("Please enter valid date");
                }

       }

       //getter and setter methods
       private String validationMessage ="";
       public String getValidationMessage() {
			return validationMessage;
		}

		public void setValidationMessage(String validationMessage) {
			this.validationMessage = validationMessage;
		}

in FilterPanel.html

span wicket:id="validationMsgLabel">[Message goes here]</span

in the above code, i did not get any error in console. And I am not able to
view the message.

Why? Please advise.

Thanking You.
Regards,
Edi
-- 
View this message in context: http://www.nabble.com/Important-concept-in-wicket--Please-advise-tf4942095.html#a14147573
Sent from the Wicket - User 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: Important concept in wicket? Please advise

Posted by Alex Objelean <al...@isdc.ro>.
you must add the component you want to update to the target in onSubmit
method, like this:

target.addComponent(filterPanelMsgLabel);

The code, tells to wicket which component to update on ajax request.

Alex.



Hi to all,

I want to display one label when I click one button.

I have wrote the code. but i am not able to display that message.

my code is looking like

file name : FilterPanel.java

 public final class ReportForm extends Form 
    {
        public ReportForm(String s, final Reports model) 
        {
        	super(s);
            setOutputMarkupId(true);

            PropertyModel filterPanelMsgModel = new PropertyModel(this,
"validationMessage");
    		final Label filterPanelMsgLabel = new Label("validationMsgLabel",
filterPanelMsgModel);		
    		filterPanelMsgLabel.setEscapeModelStrings(false);
    		filterPanelMsgLabel.setOutputMarkupId(true);
    		add(filterPanelMsgLabel);

    //in submit button, 
    AjaxSubmitLink saveButton = new AjaxSubmitLink("saveButton", this) 
            {
                protected void onSubmit(AjaxRequestTarget target, Form form) 
                {
                     // To display the string in html page.
                     setValidationMessage("Please enter valid date");
                }

       }

       //getter and setter methods
       private String validationMessage ="";
       public String getValidationMessage() {
			return validationMessage;
		}

		public void setValidationMessage(String validationMessage) {
			this.validationMessage = validationMessage;
		}

in FilterPanel.html

span wicket:id="validationMsgLabel">[Message goes here]

-- 
View this message in context: http://www.nabble.com/Important-concept-in-wicket--Please-advise-tf4942095.html#a14150303
Sent from the Wicket - User 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: Important concept in wicket? Please advise

Posted by Michael Sparer <mi...@gmx.at>.
make filterPanelMsgLabel a member attribute add e.g.

final Label l = new Label("validationMsgLabel", "newtexthere");
l.setOutPutMarkupId(true);

filterPanelMsgLabel.replaceWith(l);
target.addComponent(l);

filterPanelMsgLabel = l;

in the onclick method ...

or am I missing the point?

Michael 

Hi to all,

I want to display one label when I click one button.

I have wrote the code. but i am not able to display that message.

my code is looking like

file name : FilterPanel.java

 public final class ReportForm extends Form 
    {
        public ReportForm(String s, final Reports model) 
        {
        	super(s);
            setOutputMarkupId(true);

            PropertyModel filterPanelMsgModel = new PropertyModel(this,
"validationMessage");
    		final Label filterPanelMsgLabel = new Label("validationMsgLabel",
filterPanelMsgModel);		
    		filterPanelMsgLabel.setEscapeModelStrings(false);
    		filterPanelMsgLabel.setOutputMarkupId(true);
    		add(filterPanelMsgLabel);

    //in submit button, 
    AjaxSubmitLink saveButton = new AjaxSubmitLink("saveButton", this) 
            {
                protected void onSubmit(AjaxRequestTarget target, Form form) 
                {
                     // To display the string in html page.
                     setValidationMessage("Please enter valid date");
                }

       }

       //getter and setter methods
       private String validationMessage ="";
       public String getValidationMessage() {
			return validationMessage;
		}

		public void setValidationMessage(String validationMessage) {
			this.validationMessage = validationMessage;
		}

in FilterPanel.html

span wicket:id="validationMsgLabel">[Message goes here]


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/Important-concept-in-wicket--Please-advise-tf4942095.html#a14150001
Sent from the Wicket - User 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