This content has been marked as final.
Show 2 replies
-
1. Re: Retrieve component input value from javascript
nbelaevski Feb 13, 2009 7:16 PM (in response to thomas.m)Hello,
Client-side identifier of HTML element representing JSF component is a string consisting of all parent component that are instances of NamingContainer (typical ones are h:form, f:subview, rich:tree, rich:dataTable, h:dataTable etc.) identifiers and component identifier joined by ':' char. E.g. if you have:<h:panelGrid id="grid"><f:subview id="sv"><h:panelGroup id="group"><h:form id="_form"><h:inputText id="text">
then client id for inputText is sv:_form:text.
Ids starting from j_id are implicitly autogenerated ones.
There is a special function that you can use:#{rich:clientId('text')}
-
2. Re: Retrieve component input value from javascript
thomas.m Feb 13, 2009 8:02 PM (in response to thomas.m)Thanks a THOUSAND TIMES for this elegant, simple and WORKING solution!
I used something like this :<rich:ajaxValidator event="onchanged" oncomplete="javascript:step1CheckCloseDate('#{rich:clientId('parameter_eventName')}');"/>
Quotes are not to be forgotten since the results of 'clientId' function is a string. And then the javascript :
function step1CheckCloseDate(name) {
if (document.getElementById(name) != null &&
document.getElementById(name).value != '') {
alert('TEST');
}
}
And it works great ;)