0

I have 6 columns in my dataTable and I am particularly interested in two InputText: I must prevent the possibility of writing in both inputText on the same row. Either is written into one or the other, but not both. The solution I found is to implement a Validator and browse the dataTable or specifically visiting the tree of components with UIComponent#visitTree() on UIData as advocated by BalusC here. My question is: how do I know on which row I am? How can I retrieve the value of a InputText specifying the row ? My goal is to validate two InputText relative to another. When one has a value, the other must be null. And reciprocally.

If you have another solution, I'm interested.

Thanks for your help.

Community
  • 1
  • 1
It.Next
  • 35
  • 1
  • 1
  • 10
  • You will have UIComponent instance passed as an argument to the validate method in your validator. Call component.getClientId() to get the fully qualified id of the current component being validated. If you are in first row in datatable then the textbox id would be "formId:datatableId:rowIndex:textboxId" If you are in first row then rowIndex would be 0. Hope this helps. – Srikanth Ganji May 26 '14 at 18:38
  • Thank you for your return. I did not imagine the answer would be that simple. My attempts of recovery **dataTableSaisiePiece** do not work with `UIData datatableDEC = (UIData) context.getViewRoot()findComponent("principalTabViewDEC:0:tabviewDEC:0:formTabGeneral:dataTableSaisiePiece");` My **datatableDEC** is always null. There is certainly information that still avoid me. But I keep looking. Thank you for your help. – It.Next May 27 '14 at 11:20
  • I believe your datatable id may not be correct. Get the exact id of datatable by using view source of the page – Srikanth Ganji May 27 '14 at 13:35
  • It's possible. I use two dynamic TabView, it does not help matters. In addition, as the class TabView is a UIData, maybe I should visit the tree of components with the `method UIComponent#visitTree()`. – It.Next May 27 '14 at 15:35

0 Answers0