I have recently upgraded to Liferay 6.0, JSF 2.1 and jQuery 1.7.
Here is my html form:
1<h:form id="fundRequestForm" action="" method="post">
2 <!-- Inside this I have various form field -->
3</h:form>
I want to disable all the input fields in a form other than the hidden form fields.
here is my javascript for that
1jQuery(document).ready(function()
2{
3 var clientId = '#{lookupBean.clientId}';
4 var formID = 'form#' + clientId + ':fundRequestForm';
5 jQuery(formID + ' input[type!="hidden"]').attr('disabled', 'true');
6});
Here is my code for lookupBean.clientId:
1public String getClientId()
2{
3 UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
4 String clientId = viewRoot.getClientId();
5 UIComponent uiComponent = viewRoot.getChildren().get(0);
6 logger.log("Root clientId: " + clientId +", firstChild: " + uiComponent.getClientId() + "[ " + uiComponent.getClass().getName() + " ]", VLevel.DEBUG);
7 return clientId;
8}
For example, here is how my formID looks 'form#_jpfcpncuivr_A2262_j_id1:fundRequestForm'
and my
1jQuery('form#_jpfcpncuivr_A2262_j_id1:fundRequestForm input[type!="hidden"]').attr('disabled', 'true');
The input fields are not getting disabled. Please let me know what is wrong in this code.
Por favor, faça login para denunciar.