Wednesday, April 29, 2015

Get Drop Down Value in Java Script Function in Liferay

Sometimes we will face an issue to read the drop down values in java script function, then the below code may be use full.

Note :- In chrome browser onclick function will not work.

<aui:select name="selectvideo" id="selectvideo1" label="Select Video" onChange="getPrice()">
          <aui:option value="-1" >
                  <liferay-ui:message key="select-video" />
              </aui:option>


<script>
function getPrice() {
var sel = document.getElementById("<portlet:namespace/>selectvideo1");
document.getElementById("<portlet:namespace/>key").value = sel.options[sel.selectedIndex].value;
}
</script>


Tuesday, April 28, 2015

Call Action URL using javascript function in Liferay

Sometimes we will get a requirement that we need to hit the "Action URL" using java script function.
May be my blog will be help you fot that requirement.

   <%
           PortletURL actionURL = renderResponse.createActionURL();
           actionURL.setParameter(ActionRequest.ACTION_NAME, "getPrice");
    %>
// creating action URL which will hit the Action method called "getPrice".

<aui:form name="fm" method="POST" >

<aui:input type="text" name="price" label=""  required="true"  onclick="getPrice()" inlineLabel="true">
                                    <aui:validator name="number"></aui:validator>
                                </aui:input>

<aui:button-row>
                    <aui:button type="submit" for="Submit" key="submit" value="Submit"/>                 </aui:button-row>
</aui:form>

// I have created one form with one text field  when i click that field i need to call getPrice action URL

<script>
        function getPrice() {
            document.<portlet:namespace/>fm.action = '<%=actionURL.toString()%>';
            document.<portlet:namespace/>fm.submit();
        }

    </script>

// The above javascript code is usefull  to hit the aciton URL with javascript function without clicking the submit button through javascript we are clicking the submit button.

Hope this is helpfull for you

Friday, April 17, 2015

Properties Entry while working with Ajax calls in Liferay

Some times Ajax call will not work properly in liferay,  when you are passing parameters you will face some issues like not able to pass the values through Ajax call then add the following tags in liferay-portlet.xml
<requires-namespaced-parameters>false</requires-namespaced-parameters>
  <ajaxable>true</ajaxable>

Liferay DXP JNDI Data Source Cofiguration

 This Blog will help us to learn about the JNDI Data Source Configuration in Liferay DXP. We have tested this with Liferay 7.3 with Tomcat. ...