You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by triswork <tr...@gmail.com> on 2009/03/26 12:54:49 UTC
FormComponentPanel woes
Hi
I am getting really frustrated here because I can't figure out what I am
doing wrong. I am creating a new TextArea form component that is limited to
a particular number of characters. The trouble is, that my text area is
always rendered containing its own HTML.
Basically, I have:
public class LimitedTextArea extends FormComponentPanel implements
IHeaderContributor {
public LimitedTextArea(String id, IModel model, int limit) {
super(id, model);
TextArea textField = new TextArea("content", model);
add(textField);
...
}
}
And it is being called like this:
form.add(new LimitedTextArea("content", new PropertyModel(message,
"content"), 160));
And the TextArea always contains this text:
<textarea id="content" name="tabs:panel:form:content:text">
This is driving me absolutely mad! Anyone have any ideas?
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22720502.html
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: FormComponentPanel woes
Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
I found it in the book Wicket in Action.
triswork wrote:
> Hi Linda,
>
> No, I haven't :(
> I didn't realise I had to... Do you know where I can find some documentation
> explaining this?
>
> Thanks
>
> T
>
>
> Linda van der Pal wrote:
>
>> Hi
>>
>> Did you override onBeforeRender and convertInput?
>>
>> Regards,
>> Linda
>>
>>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.278 / Virus Database: 270.11.29/2023 - Release Date: 03/25/09 18:54:00
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: FormComponentPanel woes
Posted by Stefan Lindner <li...@visionet.de>.
I had the same problem some time ago an in my case it was the missing closing </textarea>. An in your original post you had only
<textarea id="content" name="tabs:panel:form:content:text">
Without closing </textarea>.
So it could have been the problem.
I'm sorry if this was missleading you.
Stefan
-----Ursprüngliche Nachricht-----
Von: triswork [mailto:tristan.koen@gmail.com]
Gesendet: Donnerstag, 26. März 2009 13:52
An: users@wicket.apache.org
Betreff: RE: FormComponentPanel woes
Hi Stefan
You have completely lost me on this one.
All I want to do is have my TextArea (contained within my
FormComponentPanel) to render properly without sticking arbitrary bits of
markup inside itself.
That markup you have quoted is being generated by Wicket - not by me :(
Stefan Lindner wrote:
>
> <textarea id="content" name="tabs:panel:form:content:text">
> </textarea>
>
> Should do it
>
Linda,
I don't have that book unfortunately. The javadocs do mention those two
methods, but it seems targeted at compound components. Mine is pretty
simple. I just want to decorate my textarea with some text and some
Javascript...
Linda van der Pal wrote:
>
> I found it in the book Wicket in Action.
>
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22721375.html
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FormComponentPanel woes
Posted by triswork <tr...@gmail.com>.
Thanks Linda,
That was very helpful.
I also figured out that I am a complete cretin... I forgot to replace the
<textarea> tags with tags in my original markup (where I replaced the
TextArea with my LimitedTextArea *sigh*). At least that explains why I was
getting weird content all the time :)
T
Linda van der Pal wrote:
>
> Arg, I wanted to make my changes bold. But now I see stars. Not sure if
> you get those too, but if you do: leave out the stars :)
>
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22721785.html
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: FormComponentPanel woes
Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
Arg, I wanted to make my changes bold. But now I see stars. Not sure if
you get those too, but if you do: leave out the stars :)
Linda van der Pal wrote:
> quote: "To keep the models of the nested components and the top
> component synchronized,
> we need to override two methods: onBeforeRender, which prepares for
> rendering,
> and convertInput, which handles receiving input."
>
> So your code would become something like this:
>
> public class LimitedTextArea extends FormComponentPanel implements
> IHeaderContributor {
> *private String text;
> private TextArea textField;
> * public LimitedTextArea(String id, IModel model, int limit) {
> super(id, model);
> * PropertyModel textModel = new PropertyModel(this, "text");*
> *textField *= new TextArea("content", *textModel*);
> add(textField);
> ...
> }
>
> *@Override
> public void onBeforeRender() {
> text = (String) getModelObject();
> super.onBeforeRender();
> }
>
> @Override
> public void convertInput() {
> String text = (String) textField.getConvertedInput();
> setConvertedInput(text);
> }
>
> *}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FormComponentPanel woes
Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
quote: "To keep the models of the nested components and the top
component synchronized,
we need to override two methods: onBeforeRender, which prepares for
rendering,
and convertInput, which handles receiving input."
So your code would become something like this:
public class LimitedTextArea extends FormComponentPanel implements
IHeaderContributor {
*private String text;
private TextArea textField;
* public LimitedTextArea(String id, IModel model, int limit) {
super(id, model);
* PropertyModel textModel = new PropertyModel(this, "text");*
*textField *= new TextArea("content", *textModel*);
add(textField);
...
}
*@Override
public void onBeforeRender() {
text = (String) getModelObject();
super.onBeforeRender();
}
@Override
public void convertInput() {
String text = (String) textField.getConvertedInput();
setConvertedInput(text);
}
*}
Mind you, I'm a newbie too, so this is what I got from the book. (And
for your example I haven't checked if it works.)
Linda
triswork wrote:
> Hi Stefan
>
> You have completely lost me on this one.
> All I want to do is have my TextArea (contained within my
> FormComponentPanel) to render properly without sticking arbitrary bits of
> markup inside itself.
> That markup you have quoted is being generated by Wicket - not by me :(
>
>
> Stefan Lindner wrote:
>
>> <textarea id="content" name="tabs:panel:form:content:text">
>> </textarea>
>>
>> Should do it
>>
>>
>
> Linda,
>
> I don't have that book unfortunately. The javadocs do mention those two
> methods, but it seems targeted at compound components. Mine is pretty
> simple. I just want to decorate my textarea with some text and some
> Javascript...
>
>
> Linda van der Pal wrote:
>
>> I found it in the book Wicket in Action.
>>
>>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.278 / Virus Database: 270.11.29/2023 - Release Date: 03/25/09 18:54:00
>
>
RE: FormComponentPanel woes
Posted by triswork <tr...@gmail.com>.
Hi Stefan
You have completely lost me on this one.
All I want to do is have my TextArea (contained within my
FormComponentPanel) to render properly without sticking arbitrary bits of
markup inside itself.
That markup you have quoted is being generated by Wicket - not by me :(
Stefan Lindner wrote:
>
> <textarea id="content" name="tabs:panel:form:content:text">
> </textarea>
>
> Should do it
>
Linda,
I don't have that book unfortunately. The javadocs do mention those two
methods, but it seems targeted at compound components. Mine is pretty
simple. I just want to decorate my textarea with some text and some
Javascript...
Linda van der Pal wrote:
>
> I found it in the book Wicket in Action.
>
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22721375.html
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: FormComponentPanel woes
Posted by Stefan Lindner <li...@visionet.de>.
<textarea id="content" name="tabs:panel:form:content:text">
</textarea>
Should do it
-----Ursprüngliche Nachricht-----
Von: triswork [mailto:tristan.koen@gmail.com]
Gesendet: Donnerstag, 26. März 2009 13:14
An: users@wicket.apache.org
Betreff: Re: FormComponentPanel woes
Hi Linda,
No, I haven't :(
I didn't realise I had to... Do you know where I can find some documentation
explaining this?
Thanks
T
Linda van der Pal wrote:
>
> Hi
>
> Did you override onBeforeRender and convertInput?
>
> Regards,
> Linda
>
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22720806.html
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FormComponentPanel woes
Posted by triswork <tr...@gmail.com>.
Hi Linda,
No, I haven't :(
I didn't realise I had to... Do you know where I can find some documentation
explaining this?
Thanks
T
Linda van der Pal wrote:
>
> Hi
>
> Did you override onBeforeRender and convertInput?
>
> Regards,
> Linda
>
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22720806.html
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: FormComponentPanel woes
Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
Hi
Did you override onBeforeRender and convertInput?
Regards,
Linda
triswork wrote:
> Hi
>
> I am getting really frustrated here because I can't figure out what I am
> doing wrong. I am creating a new TextArea form component that is limited to
> a particular number of characters. The trouble is, that my text area is
> always rendered containing its own HTML.
>
> Basically, I have:
>
> public class LimitedTextArea extends FormComponentPanel implements
> IHeaderContributor {
> public LimitedTextArea(String id, IModel model, int limit) {
> super(id, model);
> TextArea textField = new TextArea("content", model);
> add(textField);
> ...
> }
> }
>
> And it is being called like this:
> form.add(new LimitedTextArea("content", new PropertyModel(message,
> "content"), 160));
>
> And the TextArea always contains this text:
> <textarea id="content" name="tabs:panel:form:content:text">
>
> This is driving me absolutely mad! Anyone have any ideas?
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.278 / Virus Database: 270.11.29/2023 - Release Date: 03/25/09 18:54:00
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FormComponentPanel woes
Posted by triswork <tr...@gmail.com>.
Sorry... That last bit isn't my markup. It is the text that is appearing in
my textarea component.
My markup looks like this:
<wicket:panel>
<textarea id="content" wicket:id="content"></textarea>
<p class="note">(Maximum characters: 100) </p>
</wicket:panel>
T
Steve Flasby wrote:
>
> shoudn't that be:
>
> <textarea wicket:id="content" name="tabs:panel:form:content:text">
>
> or am I missing something?
>
> Cheers - Steve
>
--
View this message in context: http://www.nabble.com/FormComponentPanel-woes-tp22720502p22720956.html
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: FormComponentPanel woes
Posted by Steve Flasby <st...@flasby.org>.
shoudn't that be:
<textarea wicket:id="content" name="tabs:panel:form:content:text">
or am I missing something?
Cheers - Steve
triswork wrote:
> Hi
>
> I am getting really frustrated here because I can't figure out what I am
> doing wrong. I am creating a new TextArea form component that is limited to
> a particular number of characters. The trouble is, that my text area is
> always rendered containing its own HTML.
>
> Basically, I have:
>
> public class LimitedTextArea extends FormComponentPanel implements
> IHeaderContributor {
> public LimitedTextArea(String id, IModel model, int limit) {
> super(id, model);
> TextArea textField = new TextArea("content", model);
> add(textField);
> ...
> }
> }
>
> And it is being called like this:
> form.add(new LimitedTextArea("content", new PropertyModel(message,
> "content"), 160));
>
> And the TextArea always contains this text:
> <textarea id="content" name="tabs:panel:form:content:text">
>
> This is driving me absolutely mad! Anyone have any ideas?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org