Alexandre,

The way I see it, (and I'm not a javascript expert) you have two options:

1) Use forceId on the components that you need to reference from javascript, as the wiki page suggests

2) Get some kind of a reference to the inputText and pass it to the popupWindow when you create that window. There is javascript code in the new s:submitOnEvent component that may be of interest [1]. He calculates the client id of the desired component in java, using the FacesContext. Then he writes out some javascript which includes this fully-qualified id. Maybe that can give you some clues. The key lines are:

UIComponent forComponent = uiComponent.findComponent(forComponentId);
and
js.append(forComponent.getClientId(facesContext));

[1] http://svn.apache.org/repos/asf/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Alexandre Jaquet wrote:
First thanks for responding.

I need a JS solution because, the value I want to get, come from a pop up window, and I want to directly update the value of
a h:inputText and then close the pop up.

I already have read the wiki page about mixing JSF and JS but it doesn't help.

Regards

Jeff Bischoff wrote:
Alexandre,

Why use javascript for this? I would recommend a more JSF-oriented approach to master/detail. See [1].

If you're really looking for a javascript solution, there may be some tips in [2].

[1] http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters
[2] http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Alexandre Jaquet wrote:
Hi,

I'm facing a problem, I'm trying to get the id / value of a component of a data table for updating a parent window

exemple :

<h:column>
 <f:facet name="header">
    <h:outputText id="lblDealerId" value="#{text.dealer_id}" />
 </f:facet>
 <h:outputText id="txtDealerId" value="#{row.dealerId}"/>
</h:column>
<h:column>
  <h:commandLink id="lnkSelect" onclick="setDealerIdToProductDetail();">
<h:graphicImage id="imgSelect" value="/images/arrow-previous.gif" alt="#{text.common_detail}" style="border-style:none" />
   </h:commandLink>
</h:column>

but the problem is how to get a dynamic id in Javascript ? if the generated html looks like

<span id="frmLayout:dataList:0:txtDealerId">000000</span>
<span id="frmLayout:dataList:1:txtDealerId">000002</span>


regards













Reply via email to