I have a quick skim through the primefaces cookbook but I still do not quite understand how to use p:component. Maybe, I am blind or stupid. Do you mind giving me a simple example how to use it.
Let use the case in the DynaForm example, and use the "basic usage" example which has "Author" and "ISBN" as input text field. Assume that when the form get generated these two fields will be rendered but they can appear in any order and in any row, i.e. you do not know where they are. And assume that I need to perform a javascript that need to access the content of both "Author" and "ISBN" for processing when the user presss the "Submit" button.
My question is how to I write a javascript to access the content of "Author" and "ISBN" since I do not know what their ids before build time since they can be anywhere and this will affect the ids being generated. Sorry, might be a simple question, I am weak in Javascripts.
Thanks
Quick skim through the prime faces cookbook
I will let @Rapster answer this one he is the DynaForm expert.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
I'm working on a similar feature: https://stackoverflow.com/questions/563 ... components
Based on your use case scenario, I recommand to have a look at this: https://www.primefaces.org/showcase-ext ... ientId.jsf
The dirty workaround is to write something like:
And in your page:
Based on your use case scenario, I recommand to have a look at this: https://www.primefaces.org/showcase-ext ... ientId.jsf
The dirty workaround is to write something like:
Code: Select all
<pe:dynaForm id="dynaForm" value="#{containerDynaFormController.model}" var="data" varContainerId="ccId">
<pe:dynaFormControl type="INPUT">
<p:inputText id="_input" value="#{bean.property}"
<p:button value="Click" onclick="callbackDynaButton(#{ccId}:_input)" />
</pe:dynaFormControl>
</pe:dynaForm>
Code: Select all
<script>
function callbackDynaButton(id) {
alert(id);
}
</script
-
- Information
-
Who is online
Users browsing this forum: No registered users and 14 guests