You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by phelix01 <fe...@googlemail.com> on 2007/07/24 22:52:35 UTC

HTML inside commandLink or -button

Hello,
is it possible to have markup between the opening and closing tag of a
commandLink or -button? I tried:

	<h:commandButton action="#{Bean.Action}" value="#{bundle.action}">
		<t:div>
			<h:outputText value="#{Bean.Message}" />
                        <!-- verbatim doesn't work either -->
		</t:div>
	</h:commandButton>

But the markup is rendered outside of the link/button.... i know it's hard
to think of something that this is useful for. I also know that this kind of
markup is semantically incorrect. 

But maybe you know a trick how to get this done.

Thanks!
-- 
View this message in context: http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11771654
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: HTML inside commandLink or -button

Posted by phelix01 <fe...@googlemail.com>.
Thanks, for the answers. Extending the renderer would be too much effort. I
will solve it another way.


Sochor Zdeněk wrote:
> 
> Hi,
>   commandButton tag is rendered as html <input type="submit".../>  
> element, which  must not contain inner  elements. (both definitions from 
> respective specs for JSF, HTML 4)
> If you want to have inner tags in buttons, you have to extend renderer 
> for button and rewrite  its encoding to use html <button></button> 
> element along with encoding children tags/elements.
> 
> Zdenek
> 
> phelix01 napsal(a):
>> <h:commandButton><h:outputText ... /></h:commandButton> 
>>
>> With that the outputText is rendered outside.
>>
>> Seems that it is not supposed to work :)
>>
>>
>> Andrew Robinson-5 wrote:
>>   
>>> <h:commandLink><h:outputText ... /></h:commandLink>
>>>
>>> This works just fine. But, note that what you are trying to do is
>>> illegal. It is not valid HTML to have a DIV tag inside of an INPUT
>>> element.
>>>
>>> If you want an HTML element that fires an action onclick, use the
>>> sandbox submit on event component:
>>>
>>> http://wiki.apache.org/myfaces/SubmitOnEvent
>>>
>>> On 7/24/07, phelix01 <fe...@googlemail.com> wrote:
>>>     
>>>> Hello,
>>>> is it possible to have markup between the opening and closing tag of a
>>>> commandLink or -button? I tried:
>>>>
>>>>         <h:commandButton action="#{Bean.Action}"
>>>> value="#{bundle.action}">
>>>>                 <t:div>
>>>>                         <h:outputText value="#{Bean.Message}" />
>>>>                         <!-- verbatim doesn't work either -->
>>>>                 </t:div>
>>>>         </h:commandButton>
>>>>
>>>> But the markup is rendered outside of the link/button.... i know it's
>>>> hard
>>>> to think of something that this is useful for. I also know that this
>>>> kind
>>>> of
>>>> markup is semantically incorrect.
>>>>
>>>> But maybe you know a trick how to get this done.
>>>>
>>>> Thanks!
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11771654
>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11780137
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: HTML inside commandLink or -button

Posted by Sochor Zdeněk <zd...@ataco.cz>.
Hi,
  commandButton tag is rendered as html <input type="submit".../>  
element, which  must not contain inner  elements. (both definitions from 
respective specs for JSF, HTML 4)
If you want to have inner tags in buttons, you have to extend renderer 
for button and rewrite  its encoding to use html <button></button> 
element along with encoding children tags/elements.

Zdenek

phelix01 napsal(a):
> <h:commandButton><h:outputText ... /></h:commandButton> 
>
> With that the outputText is rendered outside.
>
> Seems that it is not supposed to work :)
>
>
> Andrew Robinson-5 wrote:
>   
>> <h:commandLink><h:outputText ... /></h:commandLink>
>>
>> This works just fine. But, note that what you are trying to do is
>> illegal. It is not valid HTML to have a DIV tag inside of an INPUT
>> element.
>>
>> If you want an HTML element that fires an action onclick, use the
>> sandbox submit on event component:
>>
>> http://wiki.apache.org/myfaces/SubmitOnEvent
>>
>> On 7/24/07, phelix01 <fe...@googlemail.com> wrote:
>>     
>>> Hello,
>>> is it possible to have markup between the opening and closing tag of a
>>> commandLink or -button? I tried:
>>>
>>>         <h:commandButton action="#{Bean.Action}"
>>> value="#{bundle.action}">
>>>                 <t:div>
>>>                         <h:outputText value="#{Bean.Message}" />
>>>                         <!-- verbatim doesn't work either -->
>>>                 </t:div>
>>>         </h:commandButton>
>>>
>>> But the markup is rendered outside of the link/button.... i know it's
>>> hard
>>> to think of something that this is useful for. I also know that this kind
>>> of
>>> markup is semantically incorrect.
>>>
>>> But maybe you know a trick how to get this done.
>>>
>>> Thanks!
>>> --
>>> View this message in context:
>>> http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11771654
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>>       
>>     
>
>   

Re: HTML inside commandLink or -button

Posted by Andrew Robinson <an...@gmail.com>.
Yes, that is why my example used commandLink

On 7/25/07, phelix01 <fe...@googlemail.com> wrote:
>
> <h:commandButton><h:outputText ... /></h:commandButton>
>
> With that the outputText is rendered outside.
>
> Seems that it is not supposed to work :)
>
>
> Andrew Robinson-5 wrote:
> >
> > <h:commandLink><h:outputText ... /></h:commandLink>
> >
> > This works just fine. But, note that what you are trying to do is
> > illegal. It is not valid HTML to have a DIV tag inside of an INPUT
> > element.
> >
> > If you want an HTML element that fires an action onclick, use the
> > sandbox submit on event component:
> >
> > http://wiki.apache.org/myfaces/SubmitOnEvent
> >
> > On 7/24/07, phelix01 <fe...@googlemail.com> wrote:
> >>
> >> Hello,
> >> is it possible to have markup between the opening and closing tag of a
> >> commandLink or -button? I tried:
> >>
> >>         <h:commandButton action="#{Bean.Action}"
> >> value="#{bundle.action}">
> >>                 <t:div>
> >>                         <h:outputText value="#{Bean.Message}" />
> >>                         <!-- verbatim doesn't work either -->
> >>                 </t:div>
> >>         </h:commandButton>
> >>
> >> But the markup is rendered outside of the link/button.... i know it's
> >> hard
> >> to think of something that this is useful for. I also know that this kind
> >> of
> >> markup is semantically incorrect.
> >>
> >> But maybe you know a trick how to get this done.
> >>
> >> Thanks!
> >> --
> >> View this message in context:
> >> http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11771654
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11778709
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: HTML inside commandLink or -button

Posted by phelix01 <fe...@googlemail.com>.
<h:commandButton><h:outputText ... /></h:commandButton> 

With that the outputText is rendered outside.

Seems that it is not supposed to work :)


Andrew Robinson-5 wrote:
> 
> <h:commandLink><h:outputText ... /></h:commandLink>
> 
> This works just fine. But, note that what you are trying to do is
> illegal. It is not valid HTML to have a DIV tag inside of an INPUT
> element.
> 
> If you want an HTML element that fires an action onclick, use the
> sandbox submit on event component:
> 
> http://wiki.apache.org/myfaces/SubmitOnEvent
> 
> On 7/24/07, phelix01 <fe...@googlemail.com> wrote:
>>
>> Hello,
>> is it possible to have markup between the opening and closing tag of a
>> commandLink or -button? I tried:
>>
>>         <h:commandButton action="#{Bean.Action}"
>> value="#{bundle.action}">
>>                 <t:div>
>>                         <h:outputText value="#{Bean.Message}" />
>>                         <!-- verbatim doesn't work either -->
>>                 </t:div>
>>         </h:commandButton>
>>
>> But the markup is rendered outside of the link/button.... i know it's
>> hard
>> to think of something that this is useful for. I also know that this kind
>> of
>> markup is semantically incorrect.
>>
>> But maybe you know a trick how to get this done.
>>
>> Thanks!
>> --
>> View this message in context:
>> http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11771654
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11778709
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: HTML inside commandLink or -button

Posted by Andrew Robinson <an...@gmail.com>.
<h:commandLink><h:outputText ... /></h:commandLink>

This works just fine. But, note that what you are trying to do is
illegal. It is not valid HTML to have a DIV tag inside of an INPUT
element.

If you want an HTML element that fires an action onclick, use the
sandbox submit on event component:

http://wiki.apache.org/myfaces/SubmitOnEvent

On 7/24/07, phelix01 <fe...@googlemail.com> wrote:
>
> Hello,
> is it possible to have markup between the opening and closing tag of a
> commandLink or -button? I tried:
>
>         <h:commandButton action="#{Bean.Action}" value="#{bundle.action}">
>                 <t:div>
>                         <h:outputText value="#{Bean.Message}" />
>                         <!-- verbatim doesn't work either -->
>                 </t:div>
>         </h:commandButton>
>
> But the markup is rendered outside of the link/button.... i know it's hard
> to think of something that this is useful for. I also know that this kind of
> markup is semantically incorrect.
>
> But maybe you know a trick how to get this done.
>
> Thanks!
> --
> View this message in context: http://www.nabble.com/HTML-inside-commandLink-or--button-tf4138574.html#a11771654
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>