Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Srividhya Mohanasundaram
Liferay Faces adding Default ID to form ID after Liferay 6.0 upgrade
6 de Julho de 2012 09:52
Resposta

Srividhya Mohanasundaram

Ranking: New Member

Mensagens: 19

Data de entrada: 29 de Junho de 2012

Mensagens recentes

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.
Neil Griffin
RE: Liferay Faces adding Default ID to form ID after Liferay 6.0 upgrade
9 de Julho de 2012 10:12
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1416

Data de entrada: 26 de Julho de 2005

Mensagens recentes

There is a post at stackoverflow that indicates that for jQuery 1.6+ you should use the prop() function instead of the attr() function. Maybe give that a try.
Neil Griffin
RE: Liferay Faces adding Default ID to form ID after Liferay 6.0 upgrade
10 de Julho de 2012 07:34
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1416

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Follow-up: Looks like Srividhya got a good answer from BlausC at stackoverflow.com