You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by rawe <ra...@dachser.com> on 2010/11/16 11:47:41 UTC

Missing FeedbackPanel : Component-targetted feedback message was left unrendered

My Problem is the correct display of a feedbackpanel.
The feedbackpanel is defined in a fragment component.
I have a page including a form including a fragment including a repeater
(DataView).
The DataView creates  textfields in the populateItem() method.
The textfields are set to required=true.

I want to validate and display the textfield when submitting the form.
Problem: I get following message and no feedbackpanel:
(WebSession.java:193) -Component-targetted feedback message was left
unrendered. This could be because you are missing a FeedbackPanel on the
page.  
Message: [FeedbackMessage message = " error message ...", reporter = tfi,
level = ERROR]

But:
When I set an Ajax event on the textfield e.g.
AjaxFormComponentUpdatingBehavior("onblur") and
call target.addComponent(feedbackPanel); in onUpdate() method the
feedbackpanel is displayed correctly.

How is it possible to display the feedback panel when doing a "normal" form
submit without ajax ?
It seems to be the problem that the textfield components are created
dynamically and they don't know their feedbackpanel !?
Is there a solution to set the textfields the feedbackpanel (without ajax) ?

Thanks for hints!

Ralph

see my code example:


public class MyPage extends WebPage {

	public MyPage() {
	
		Form form = new Form("form") {
		
			@Override
			protected void onSubmit() {
				setResponsePage(IndexPage.class);
			}
		
			@Override
			protected void onError() {
				...
			}
		
		}
		
		form.add(new MyFragment("fragment"));
		
		Button btnSave = new Button("btnSave", "Save");
		form.add(btnSave);
		
		this.add(form);
	}

}


public class MyFragment extends Fragment {

		private FeedbackPanel feedbackpanel;

		public MyFragment1(String id) {
			super(id, "fragment1", MyPage.this);

			feedbackpanel = new FeedbackPanel("feedback1",
					new ContainerFeedbackMessageFilter(this));
			add(feedbackpanel);
			
			myContainer = new WebMarkupContainer("myContainer");
			myContainer.add(new MyDataViewTable("tblList", list));
			add(myContainer);
	 }
	 
}


Here my  DataView - Repeater populateItem method:


protected void populateItem(Item item) {
	...
	TextField tfi = new TextField<String>();
	tfi.setRequired(true);
	tfi.add(new AjaxFormComponentUpdatingBehavior("onblur") {
		@Override
		protected void onUpdate(AjaxRequestTarget target) {
			target.addComponent(feedbackPanel);
		}

		@Override
		protected void onError(AjaxRequestTarget target, RuntimeException e) {
			target.addComponent(feedbackPanel);
		}
	});
	
	
	item.add(tfi);
	
	...
	
	}


My Markup:

	
<html>
<head>
...	
</head>
<body> 
<form wicket:id="form">
<div wicket:id="content" />
<wicket:fragment wicket:id="fragment1">
		<fieldset id="xyz">
		<table width="100%" cellspacing="0"  cellpadding="2" class="foo"
wicket:id="myContainer">
				<tr class="odd" wicket:id="tblList">
					<td><input wicket:id="tfiField1" id="l0" name="l0" type="text"
maxlength="35"></td>
					<td><input wicket:id="tfiField2" id="l1" name="l1" type="text"
maxlength="35"></td>
					<td><input wicket:id="tfiField3"i d="l2" name="l2" type="text"
maxlength="35"></td>
					<td><input wicket:id="tfiField4" id="l3" name="l3" type="text"
maxlength="35"></td>
				</tr>
		</table>
			
		
		</fieldset>
</wicket:fragment>
</form>
</body>
</html>

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Missing-FeedbackPanel-Component-targetted-feedback-message-was-left-unrendered-tp3044576p3044576.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: Missing FeedbackPanel : Component-targetted feedback message was left unrendered

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Thanks for sharing your solution!

Bye.
> I got the solution!
> Just adding setReuseItems(true) to the ListView and it's working!
>    


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


Re: Missing FeedbackPanel : Component-targetted feedback message was left unrendered

Posted by rawe <ra...@dachser.com>.
I got the solution!
Just adding setReuseItems(true) to the ListView and it's working!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-Missing-FeedbackPanel-Component-targetted-feedback-message-was-left-unrendered-tp3044576p3046430.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: Missing FeedbackPanel : Component-targetted feedback message was left unrendered

Posted by rawe <ra...@dachser.com>.
Yes, I've tried it and it works!
But my goal is to use several FeedbackPanels in my page.
So I'm using several fragments each with an own FeedbackPanel.
This design also works well if the fragment uses static FormComponents.
But if the fragment uses a ListView (or DataView) where the FormComponents
are created dynamically 
the FeedbackPanel is not rendered.


-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-Missing-FeedbackPanel-Component-targetted-feedback-message-was-left-unrendered-tp3044576p3046298.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: Missing FeedbackPanel : Component-targetted feedback message was left unrendered

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi, have you tried moving FeedbackPanel out of fragment? You could put 
it at the end of the form like this:


<form>
...
<div wicket:id="feedback">
</div>

</form>


and then you could add it directly to form:


form.add(new RedFeedbackPanel("feedback"));
> My Problem is the correct display of a feedbackpanel.
> The feedbackpanel is defined in a fragment component.
> I have a page including a form including a fragment including a repeater
> (DataView).
> The DataView creates  textfields in the populateItem() method.
> The textfields are set to required=true.
>
> I want to validate and display the textfield when submitting the form.
> Problem: I get following message and no feedbackpanel:
> (WebSession.java:193) -Component-targetted feedback message was left
> unrendered. This could be because you are missing a FeedbackPanel on the
> page.
> Message: [FeedbackMessage message = " error message ...", reporter = tfi,
> level = ERROR]
>
> But:
> When I set an Ajax event on the textfield e.g.
> AjaxFormComponentUpdatingBehavior("onblur") and
> call target.addComponent(feedbackPanel); in onUpdate() method the
> feedbackpanel is displayed correctly.
>
> How is it possible to display the feedback panel when doing a "normal" form
> submit without ajax ?
> It seems to be the problem that the textfield components are created
> dynamically and they don't know their feedbackpanel !?
> Is there a solution to set the textfields the feedbackpanel (without ajax) ?
>
> Thanks for hints!
>
> Ralph
>
> see my code example:
>
>
> public class MyPage extends WebPage {
>
> 	public MyPage() {
> 	
> 		Form form = new Form("form") {
> 		
> 			@Override
> 			protected void onSubmit() {
> 				setResponsePage(IndexPage.class);
> 			}
> 		
> 			@Override
> 			protected void onError() {
> 				...
> 			}
> 		
> 		}
> 		
> 		form.add(new MyFragment("fragment"));
> 		
> 		Button btnSave = new Button("btnSave", "Save");
> 		form.add(btnSave);
> 		
> 		this.add(form);
> 	}
>
> }
>
>
> public class MyFragment extends Fragment {
>
> 		private FeedbackPanel feedbackpanel;
>
> 		public MyFragment1(String id) {
> 			super(id, "fragment1", MyPage.this);
>
> 			feedbackpanel = new FeedbackPanel("feedback1",
> 					new ContainerFeedbackMessageFilter(this));
> 			add(feedbackpanel);
> 			
> 			myContainer = new WebMarkupContainer("myContainer");
> 			myContainer.add(new MyDataViewTable("tblList", list));
> 			add(myContainer);
> 	 }
> 	
> }
>
>
> Here my  DataView - Repeater populateItem method:
>
>
> protected void populateItem(Item item) {
> 	...
> 	TextField tfi = new TextField<String>();
> 	tfi.setRequired(true);
> 	tfi.add(new AjaxFormComponentUpdatingBehavior("onblur") {
> 		@Override
> 		protected void onUpdate(AjaxRequestTarget target) {
> 			target.addComponent(feedbackPanel);
> 		}
>
> 		@Override
> 		protected void onError(AjaxRequestTarget target, RuntimeException e) {
> 			target.addComponent(feedbackPanel);
> 		}
> 	});
> 	
> 	
> 	item.add(tfi);
> 	
> 	...
> 	
> 	}
>
>
> My Markup:
>
> 	
> <html>
> <head>
> ...	
> </head>
> <body>
> <form wicket:id="form">
> <div wicket:id="content" />
> <wicket:fragment wicket:id="fragment1">
> 		<fieldset id="xyz">
> 		<table width="100%" cellspacing="0"  cellpadding="2" class="foo"
> wicket:id="myContainer">
> 				<tr class="odd" wicket:id="tblList">
> 					<td><input wicket:id="tfiField1" id="l0" name="l0" type="text"
> maxlength="35"></td>
> 					<td><input wicket:id="tfiField2" id="l1" name="l1" type="text"
> maxlength="35"></td>
> 					<td><input wicket:id="tfiField3"i d="l2" name="l2" type="text"
> maxlength="35"></td>
> 					<td><input wicket:id="tfiField4" id="l3" name="l3" type="text"
> maxlength="35"></td>
> 				</tr>
> 		</table>
> 			
> 		
> 		</fieldset>
> </wicket:fragment>
> </form>
> </body>
> </html>
>
>    


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