0

In the attribute for of the element <label>, is there a way to make reference to a generated jsf id?

The jquery will now work there, it will generate:

<label for='$(this).closest(".my-input-text").attr("id")'>MyLabel</label>

<span class="generated-spam-element">
  <span class="generated-spam-element">
    <input id="jsf:long:generated:id:MyInput" class="my-input-text" />
  </span>
</span>

(I'm also using primefaces, if there's any solution using it)

The Student
  • 27,520
  • 68
  • 161
  • 264
  • Use https://www.primefaces.org/showcase/ui/misc/outputLabel.xhtml – Jasper de Vries Apr 09 '19 at 22:15
  • @JasperdeVries the `for="@next"` will not work, becouse my target input is also generated by primefaces inside two `` elements... But I have the id of the input (the last part of it, "MyInput" in the example), if I could reference that id. – The Student Apr 09 '19 at 22:58
  • 1
    https://stackoverflow.com/questions/8634156/how-to-find-out-client-id-of-component-for-ajax-update-render-cannot-find-compo – Jasper de Vries Apr 09 '19 at 23:06

1 Answers1

0

It did work with h:outputLabel instead of label or p:outputLabel.

The Student
  • 27,520
  • 68
  • 161
  • 264