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>


3 comments:

jackerbombs said...

I ordinarily never comment on code advice online, but I couldn't find an example like this anywhere and it solved a problem I've been working on for hours. thank you very much!

Unknow said...

Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work. 经济代写

Inthiyaz Shaik said...

Thank you

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. ...