You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2014/02/28 20:33:04 UTC

Show textfield as plaintext when disabled?

Is there a way to have my textfield show as plain text when in a readonly
mode rather than as a disabled textbox?

Backup question: I can imagine making a panel to do this...having a
textfield and label and hiding whichever I didn't want, but I would want my
panel to bind to a textbox in the parent page and replace that tag
(otherwise I would have two textboxes, right).  How would I go about that?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723.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: Show textfield as plaintext when disabled?

Posted by Chris Snyder <ch...@biologos.org>.
One potential issue: Depending on where you're using the technique, it
could lead to problems. For instance, if you are implementing in-place-edit
functionality on a public-facing page, having a lot of your content in
<input/> tags could make the content invisible to search engines (I'm just
guessing here - it would make sense for search engines to ignore form
content, but I don't know if this is true). Even if search engines aren't a
concern, it's contrary to semantic HTML, and could lead to problems for
non-graphical browsers.

Nevertheless, it's easy, and certainly acceptable for many situations.
Still, I stand by my initial "cludgy" assertion. :-)

-Chris


On Mon, Mar 3, 2014 at 4:04 AM, Stijn de Witt <
Stijn.deWitt@planonsoftware.com> wrote:

> I wouldn't call it cludgy... 'pragmatic' is the word that comes to mind  :)
>
> Big advantage of styling the input as regular text instead of completely
> replacing the HTML element is that all other behavior remains as expected.
> The field is still submitted with the form etc.
>
> -Stijn
>
>
> -----Original Message-----
> From: Chris Snyder [mailto:chris.snyder@biologos.org]
> Sent: zaterdag 1 maart 2014 17:54
> To: Wicket users mailing list mailing list
> Subject: Re: Show textfield as plaintext when disabled?
>
> I also ended up going the panel route for this.
>
> An alternative - perhaps a bit cludgy - would be to style the input fields
> as plain text using CSS (remove the border & outline, alter the padding,
> etc.).
>
> -Chris
>
> On Sat, Mar 1, 2014 at 6:35 AM, Andrea Del Bene <an.delbene@gmail.com
> >wrote:
>
> > Hi, l've tried to do a similar thing a couple of months ago but it was
> > very tricky and l ended up using a panel with two components (text
> > field and a label).
> > You can use methods oncomponenttag and onxomponenttagbody to
> > dynamically change the tag and the body depending on component status
> (view or edit)...
> > Good luck :).
> > On Feb 28, 2014 8:34 PM, "Entropy" <bl...@gmail.com> wrote:
> >
> > > Is there a way to have my textfield show as plain text when in a
> > > readonly mode rather than as a disabled textbox?
> > >
> > > Backup question: I can imagine making a panel to do this...having a
> > > textfield and label and hiding whichever I didn't want, but I would
> > > want
> > my
> > > panel to bind to a textbox in the parent page and replace that tag
> > > (otherwise I would have two textboxes, right).  How would I go about
> > that?
> > >
> > > --
> > > View this message in context:
> > >
> > http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext
> > -when-disabled-tp4664723.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: Show textfield as plaintext when disabled?

Posted by Stijn de Witt <St...@planonsoftware.com>.
I wouldn't call it cludgy... 'pragmatic' is the word that comes to mind  :)

Big advantage of styling the input as regular text instead of completely replacing the HTML element is that all other behavior remains as expected. The field is still submitted with the form etc.

-Stijn


-----Original Message-----
From: Chris Snyder [mailto:chris.snyder@biologos.org] 
Sent: zaterdag 1 maart 2014 17:54
To: Wicket users mailing list mailing list
Subject: Re: Show textfield as plaintext when disabled?

I also ended up going the panel route for this.

An alternative - perhaps a bit cludgy - would be to style the input fields as plain text using CSS (remove the border & outline, alter the padding, etc.).

-Chris

On Sat, Mar 1, 2014 at 6:35 AM, Andrea Del Bene <an...@gmail.com>wrote:

> Hi, l've tried to do a similar thing a couple of months ago but it was 
> very tricky and l ended up using a panel with two components (text 
> field and a label).
> You can use methods oncomponenttag and onxomponenttagbody to 
> dynamically change the tag and the body depending on component status (view or edit)...
> Good luck :).
> On Feb 28, 2014 8:34 PM, "Entropy" <bl...@gmail.com> wrote:
>
> > Is there a way to have my textfield show as plain text when in a 
> > readonly mode rather than as a disabled textbox?
> >
> > Backup question: I can imagine making a panel to do this...having a 
> > textfield and label and hiding whichever I didn't want, but I would 
> > want
> my
> > panel to bind to a textbox in the parent page and replace that tag 
> > (otherwise I would have two textboxes, right).  How would I go about
> that?
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext
> -when-disabled-tp4664723.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: Show textfield as plaintext when disabled?

Posted by Chris Snyder <ch...@biologos.org>.
I also ended up going the panel route for this.

An alternative - perhaps a bit cludgy - would be to style the input fields
as plain text using CSS (remove the border & outline, alter the padding,
etc.).

-Chris

On Sat, Mar 1, 2014 at 6:35 AM, Andrea Del Bene <an...@gmail.com>wrote:

> Hi, l've tried to do a similar thing a couple of months ago but it was very
> tricky and l ended up using a panel with two components (text field and a
> label).
> You can use methods oncomponenttag and onxomponenttagbody to dynamically
> change the tag and the body depending on component status (view or edit)...
> Good luck :).
> On Feb 28, 2014 8:34 PM, "Entropy" <bl...@gmail.com> wrote:
>
> > Is there a way to have my textfield show as plain text when in a readonly
> > mode rather than as a disabled textbox?
> >
> > Backup question: I can imagine making a panel to do this...having a
> > textfield and label and hiding whichever I didn't want, but I would want
> my
> > panel to bind to a textbox in the parent page and replace that tag
> > (otherwise I would have two textboxes, right).  How would I go about
> that?
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723.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: Show textfield as plaintext when disabled?

Posted by Andrea Del Bene <an...@gmail.com>.
Hi, l've tried to do a similar thing a couple of months ago but it was very
tricky and l ended up using a panel with two components (text field and a
label).
You can use methods oncomponenttag and onxomponenttagbody to dynamically
change the tag and the body depending on component status (view or edit)...
Good luck :).
On Feb 28, 2014 8:34 PM, "Entropy" <bl...@gmail.com> wrote:

> Is there a way to have my textfield show as plain text when in a readonly
> mode rather than as a disabled textbox?
>
> Backup question: I can imagine making a panel to do this...having a
> textfield and label and hiding whichever I didn't want, but I would want my
> panel to bind to a textbox in the parent page and replace that tag
> (otherwise I would have two textboxes, right).  How would I go about that?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723.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: Show textfield as plaintext when disabled?

Posted by Peter Henderson <pe...@starjar.com>.
Hi guys,


On 4 March 2014 18:39, Entropy <bl...@gmail.com> wrote:

> What a great bunch of ideas.  I'll be implementing at least one of them.
> Thanks for all your ideas.  Does anyone have similar techniques for
> dropdowns?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723p4664771.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
>
>
​
I'll add my 0.02 BTC worth.

I use the panel approach, which contains an edit form field and display
label.
Mainly because I tend to display additional information.

e.g.
MoneyDisplayEditField shows not only the amount but also the currency
25.99[GBP]
StockQty shows the units of the stock.  50 [units]
PartNumber a link in display mode, a fancy ajax chooser in edit mode.
PaymentTerms, a drop down in edit, link in display
etc.


Hope that helps.



Peter​

RE: Show textfield as plaintext when disabled?

Posted by Entropy <bl...@gmail.com>.
What a great bunch of ideas.  I'll be implementing at least one of them. 
Thanks for all your ideas.  Does anyone have similar techniques for
dropdowns?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723p4664771.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: Show textfield as plaintext when disabled?

Posted by Stijn de Witt <St...@planonsoftware.com>.
It is fairly easy to style a textfield as plain text by disabling the border and giving it a transparent background color:

input[readonly=readonly] {
	border: none;
	background: transparent;
}

-Stijn

-----Original Message-----
From: Entropy [mailto:blmulholland@gmail.com] 
Sent: vrijdag 28 februari 2014 20:33
To: users@wicket.apache.org
Subject: Show textfield as plaintext when disabled?

Is there a way to have my textfield show as plain text when in a readonly mode rather than as a disabled textbox?

Backup question: I can imagine making a panel to do this...having a textfield and label and hiding whichever I didn't want, but I would want my panel to bind to a textbox in the parent page and replace that tag (otherwise I would have two textboxes, right).  How would I go about that?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723.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: Show textfield as plaintext when disabled?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think it is OK to remove 'final' from TextArea's #onComponentTagBody().
Please file a ticket.
About the other problem - you cannot just skip Java components when there
are HTML elements for them. You either have to use some Panel that shows
the read-only version of the radio group, or you need to use "empty" Java
components, like WebMarkupContainer/WebComponent, i.e. a Java component
that won't render anything but will just fulfil the need of a Java
component in the hierarchy.

Martin Grigorov
Wicket Training and Consulting


On Thu, Mar 20, 2014 at 7:27 PM, Entropy <bl...@gmail.com> wrote:

> Of course the instant I submit the question, I thought of something else to
> try.  I stopped overriding onComponentTag and changed the body to:
>
>         @SuppressWarnings("unchecked")
>         public void onComponentTagBody(final MarkupStream markupStream,
> final
> ComponentTag openTag) {
>                 if (!isEnabledInHierarchy()) {
>                         replaceComponentTagBody(markupStream, openTag,
> convertValueToRender((T)getDefaultModelObject()));
>                 }
>                 super.onComponentTagBody(markupStream, openTag);
>         }
>
> it turns out the prior error was when the item was enabled.  The super lets
> me get past the enabled phase and to when it is disabled.  At which point
> the below error happens.  This error is much more to the point.  It doesn't
> like that I have children and am erasing my body.  But that's actually what
> I want to do.  How can I tell wicket that I really do want that?
>
> And of course the TextArea question still stands.
>
> This results in
> org.apache.wicket.markup.MarkupException: Expected close tag for
> '<wicket:container wicket:id="myRadio">' Possible attempt to embed
> component(s) '<input wicket:id="myRadioYes" type="radio" name="adtype"/>'
> in
> the body of this component which discards its body
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723p4665062.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: Show textfield as plaintext when disabled?

Posted by Entropy <bl...@gmail.com>.
Of course the instant I submit the question, I thought of something else to
try.  I stopped overriding onComponentTag and changed the body to:

	@SuppressWarnings("unchecked")
	public void onComponentTagBody(final MarkupStream markupStream, final
ComponentTag openTag) { 
		if (!isEnabledInHierarchy()) { 
			replaceComponentTagBody(markupStream, openTag,
convertValueToRender((T)getDefaultModelObject())); 
		}
		super.onComponentTagBody(markupStream, openTag);
	} 

it turns out the prior error was when the item was enabled.  The super lets
me get past the enabled phase and to when it is disabled.  At which point
the below error happens.  This error is much more to the point.  It doesn't
like that I have children and am erasing my body.  But that's actually what
I want to do.  How can I tell wicket that I really do want that?

And of course the TextArea question still stands.

This results in 
org.apache.wicket.markup.MarkupException: Expected close tag for
'<wicket:container wicket:id="myRadio">' Possible attempt to embed
component(s) '<input wicket:id="myRadioYes" type="radio" name="adtype"/>' in
the body of this component which discards its body



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723p4665062.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: Show textfield as plaintext when disabled?

Posted by Entropy <bl...@gmail.com>.
*bump*  

I still need help making this technique work for TextAreas whose
onComponentTagBody methods are final.  I have also discovered the need for
this in a RadioGroup.  I apply RadioGroup to a <wicket:container> which
wraps some markup that includes my radio buttons.  Works fine.  In readonly,
I wanted to display just the text of the selected radio button.  I applied
similar styles and got the below error.  Can anyone advise on what I am
doing wrong?

CODE:
	public String convertValueToRender(T curValue) {
		if(curValue == null)
			return "";
		else
			return curValue.toString();
	}
	
	public void onComponentTag(ComponentTag tag) { 
		super.onComponentTag(tag); 
		if (!isEnabledInHierarchy()) { 
			tag.setName("span"); 
			tag.setType(TagType.OPEN); 
		} 
	} 

	@SuppressWarnings("unchecked")
	public void onComponentTagBody(final MarkupStream markupStream, final
ComponentTag openTag) { 
		if (!isEnabledInHierarchy()) { 
			replaceComponentTagBody(markupStream, openTag,
convertValueToRender((T)getDefaultModelObject())); 
		}
	} 

HTML:
						<wicket:container wicket:id="myRadio">
		                <ul>
		                  <li>
		                    <input wicket:id="myRadioYes" type="radio"
name="adtype" />
		                    <label>Yes</label>
		                  </li>
		                  <li>
		                    <input wicket:id="myRadioNo" type="radio"
name="adtype" />
		                    <label>No</label>
		                  </li>
		                </ul>
		                </wicket:container>


Error:
org.apache.wicket.markup.MarkupException: Expected close tag for
<wicket:container wicket:id="myRadio">
	at
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.Component.renderClosingComponentTag(Component.java:4253)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRenderComponent(Component.java:2557)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRender(Component.java:2379)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.render(Component.java:2307)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:1683)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRender(Component.java:2379)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.render(Component.java:2307)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Page.onRender(Page.java:876)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRender(Component.java:2379)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.render(Component.java:2307)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Page.renderPage(Page.java:1010)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:274)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
~[wicket-request-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
[wicket-core-6.12.0.jar:6.12.0]
	at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:997)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:1043)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:963)
[com.ibm.ws.webcontainer.jar:?]
	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
[com.ibm.ws.webcontainer.jar:?]
	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
[com.ibm.ws.webcontainer.jar:?]
	at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[com.ibm.ws.runtime.jar:?]
	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[com.ibm.ws.runtime.jar:?]
	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[com.ibm.ws.runtime.jar:?]
	at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[com.ibm.ws.runtime.jar:?]
	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[com.ibm.ws.runtime.jar:?]
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
[com.ibm.ws.runtime.jar:?]


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723p4665060.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: Show textfield as plaintext when disabled?

Posted by Entropy <bl...@gmail.com>.
Igor,

This was great.  Exactly what I needed.  I applied this to my TextField and
DropDownChoice with a few tweaks and it's perfect.  But when I went to do
the same to TextArea, I am told that onComponentTagBody is final and cannot
be overridden.

So i tired without that method overidden like so:

	public void onComponentTag(ComponentTag tag) { 
		super.onComponentTag(tag); 
		if (!isEnabledInHierarchy()) { 
			tag.setName("label"); 
			tag.remove("type"); 
			tag.remove("value"); 
			tag.remove("disabled");
			tag.setType(TagType.OPEN); 
		} 
	} 

//	public void onComponentTagBody(final MarkupStream markupStream, final
ComponentTag openTag) { 
//		if (!isEnabledInHierarchy()) { 
//			replaceComponentTagBody(markupStream, openTag,
getDefaultModelObjectAsString()); 
//		}
//	} 

And that produced the following exception:
org.apache.wicket.markup.MarkupException: Component [narrative] (path =
[4:oagForm:narrative]) must be applied to a tag of type [textarea], not: 
'<label wicket:id="narrative" name="narrative">' (line 0, column 0)
	at
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.checkComponentTag(Component.java:3550)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.markup.html.form.TextArea.onComponentTagBody(TextArea.java:65)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRender(Component.java:2379)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.render(Component.java:2307)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:1683)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRender(Component.java:2379)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.render(Component.java:2307)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Page.onRender(Page.java:876)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.internalRender(Component.java:2379)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Component.render(Component.java:2307)
~[wicket-core-6.12.0.jar:6.12.0]
	at org.apache.wicket.Page.renderPage(Page.java:1010)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:274)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861)
~[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
~[wicket-request-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
[wicket-core-6.12.0.jar:6.12.0]
	at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
[wicket-core-6.12.0.jar:6.12.0]


I love this technique as it is so clean and direct to the problem.  How can
I make it work for TextArea?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723p4664868.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: Show textfield as plaintext when disabled?

Posted by Igor Vaynberg <ig...@gmail.com>.
class MyTextField extends TextField {
  onComponentTag(tag) {
    super.onComponentTag(tag);
    if (!enabledInHierarchy()) {
        tag.setName("label");
        tag.removeAttribute("type");
        tag.removeAttribute("value");
        tag.setType(TagType.OPEN);
    }
  }

 void onComponentTagBody(final MarkupStream markupStream, final
ComponentTag openTag) {
     replaceComponentTagBody(markupStream, openTag,
getDefaultModelObjectAsString());
  }
}

-igor

On Fri, Feb 28, 2014 at 11:33 AM, Entropy <bl...@gmail.com> wrote:
> Is there a way to have my textfield show as plain text when in a readonly
> mode rather than as a disabled textbox?
>
> Backup question: I can imagine making a panel to do this...having a
> textfield and label and hiding whichever I didn't want, but I would want my
> panel to bind to a textbox in the parent page and replace that tag
> (otherwise I would have two textboxes, right).  How would I go about that?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Show-textfield-as-plaintext-when-disabled-tp4664723.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