Archive for April, 2010

jQuery enable-disable elements

Let’s summarise here how to disable, enable, check, assign values and get selected values from your html document.

1
2
3
4
5
<select name="client.idClient" id="idClient">
<option value="1">CLIENT 1</option>
<option value="2">CLIENT 2</option>
<option value="3">CLIENT 3</option>
</select>

You can disable an element by setting the disabled attribute to disabled:

1
jQuery("#idClient").attr("disabled","disabled");

And enable the element by removing the disabled attribute:

1
jQuery("#idClient").removeAttr("disabled");

If the element is an input:

1
<input type="checkbox" id="yes"/>

then you have to [...]

JavaScript Liferay.PortletURL

Liferay Portal has a JavaScript library that allows the creation of portletURLs inside your JavaScript code. Something like:

<input type="button" value="<liferay-ui:message key="cancel" />"
onclick="<portlet:namespace/>_back();"/>
 
<script type="text/javascript">
 
function <portlet:namespace/>_back() {
 
var backURL = Liferay.PortletURL.createRenderURL();
[...]

Liferay hook war

Liferay Hooks are plugins that let you customise some of the Portal functionality.
In this post we are creating a simple Liferay hook to change the value of a property in the portal.properties, override one of the Portal jsps and handling an event.

Maven useful links

Some Maven useful links:
Maven lifecycle:
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
Maven create web app
http://maven.apache.org/plugins/maven-archetype-plugin/examples/webapp.html
Maven plugins
http://maven.apache.org/plugins/
Work on progress… any suggestions?