Focusing the form field in Liferay

  Whenever we create from in liferay ,it is required cursor to focus on the first field.

  Suppose we can have form like this

  <aui:from name="fm" method="post" action="${updateActionURL}">
   
        <aui:input  name="title" label = "Title"/>

       <aui:input  name="desc" label = "Desc"/>

      <aui:button type="submit" value ="save"/>

<.aui:form>

 If we think title should be highlited on page load , following script is also required.


<aui:script>

Liferay.Util.focusFormField(document.<portlet:namespace/>fm.<portlet:namespace/>title);

</aui:script>

Deploy your project and refresh your page . We can see the first field is highlighted.

These source are avaliable in the follwing path.

      portal-web/docroot/html/js/liferay


Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate