留言板

How to get the <AUI:select> value ?

liferay liferay,修改在10 年前。

How to get the <AUI:select> value ?

New Member 帖子: 22 加入日期: 13-12-19 最近的帖子
JSP:


<aui:input name="inputValue" label="Input Value" type="text"></aui:input>

<aui:select name="testSelect" label="Test Select">
			<aui:option selected="true" value="ALL">All</aui:option>
			<aui:option value="YES">Yes</aui:option>
			<aui:option value="NO">No</aui:option>
		</aui:select>



Script:
var inputValue= A.one('#<portlet:namespace/>inputValue').get('value');
var selectedValue = A.one('#<portlet:namespace/>testSelect').get('value');



I am new to AUI. Once when i use A.One("Element ID").get('value'), it is work only for input box but not selectionbox.

I want ask how to get the selected value from selectionbox?

Thanks
thumbnail
meera prince,修改在10 年前。

RE: How to get the <AUI:select> value ?

Liferay Legend 帖子: 1111 加入日期: 11-2-8 最近的帖子
Hi
It should work . ans all the code better put in AUI use method.

however try this and this is working for me


<aui:select name="testSelect" id="testSelect" label="Test Select">
            <aui:option selected="true" value="ALL">All</aui:option>
            <aui:option value="YES">Yes</aui:option>
            <aui:option value="NO">No</aui:option>
</aui:select>     
<aui:script>
AUI().use('aui-base', function(A){
A.one("#<portlet:namespace />testSelect").on('change',function(){
var selectedValue = A.one('#<portlet:namespace />testSelect').get('value');
 alert(selectedValue);
})

});
</aui:script>


Regards,
meera prince
thumbnail
mohammad azaruddin,修改在9 年前。

RE: How to get the <AUI:select> value ?

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
HI prince

How to get the value in the script if the attribute multiple ="true"

and A.all(':selected') this will return selected value from all the select node but i want to get the value from perticular node having name say firstSelect