This discussion is archived
0 Replies Latest reply: Aug 7, 2012 11:08 PM by Amasoni RSS

RE:Reference a component in a form from a datatable outside <h:form>

Amasoni Newbie
Currently Being Moderated
I'd like to refer to the component id=contractIdInputText in the form below from a datatable <f:ajax > tag in a commandlink. I want to use its' id in the render attribute instead of @all. I used @all below only because i was not able to refer to the id. The datatable is outside and above the <h:form> tags.

<h:form id="contracts">
<h:outputScript library="js" name="common.js" target="head"/>
<h:panelGrid columns="3"
columnClasses="rightalign,leftalign,leftalign">

<h:outputLabel for="contractIdInputText" rendered="true" value="Contract Nooo.: " />
<h:inputText id="contractIdInputText" required="true" value="#{contractManager.newContractId}" />
</form>

This is the datatable's commandlink:

<h:commandLink id="editLink" value="#{bundle.ListUnitEditLink}"
action="#{contractManager.updateContract}">
<f:ajax onevent="disablePK"
render="@all" />
</h:commandLink>

The whole purpose of the ajax in the link is to disable the form component when i click the commandlink and populate the form. I've also noticed that much as using the @all does what i want (populate the form with the inputText disabled), it results in me needing to click the commandlink twice on an commandlink in he datatable for the form to be populated with another item. why is this happening?

Thnx so much!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points