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
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
Post a Comment