开发者

RichFaces rich:clientId within facelets

开发者 https://www.devze.com 2023-01-02 12:47 出处:网络
I\'m trying to something like this: <?xml version=\"1.0\"/> <ui:composition ....> <h:inputText id=\"#{id}InputText\" value=\"#{value}\"/>

I'm trying to something like this:

<?xml version="1.0"/>
<ui:composition ....>
    <h:inputText id="#{id}InputText" value="#{value}"/>

    <rich:calendar id="#{id}Shevron"
        popup="true"
        datePattern="ddMMyy"
        showInput="false" 
        todayControlMode="hidden"
        enableManualInput="false"
        showApplyButton="false"
        updateDays="14"
        ondateselected="alert('#{rich:clientId('#{id}Shevron')}');"
        inputClass="xwingml-input"/>
</ui:composition&g开发者_如何学Ct;

The problem I'm facing here is that the actual client id is generated for my facelts components. Is there a way to pass an id to rich:clientId like this? If not how would one go about this kind of problem?

Thanks in advance!.


An old question, but here I write down my solution in case it helps someone.

You can pass parameters to JSTL functions without needing the evaluation operators ( #{} ${} ). Take a look at this String length example.

So if your "id" wasn't dynamically generated this will solve your problem:

#{rich:clientId(id)}

But in your case you need to define an additional variable to store your dynamic id:

<c:set var="myDynamicID" value="${id}Shevron"/>

And then use it to obtain the client UI.

#{rich:clientId(myDynamicID)}


All rich:clientId does it to render document.getElementById() and provide the full id.

So don't use #{rich:clientId('#{id}Shevron')} and just use document.getElementById('#{id}Shevron'); and ensure that you specify the full ID (ie. including the form ID etc)

0

精彩评论

暂无评论...
验证码 换一张
取 消