Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aryan sds
Get value of autocomplete field onchange of other textfields
October 26, 2013 12:58 AM
Answer

Aryan sds

Rank: Junior Member

Posts: 57

Join Date: April 24, 2012

Recent Posts

Hi,

I have 2 input text fields in my form using one is autocomplete fields(liferay) and other is normal text fields.

Now I want to check the value of autocomplete field onchange(as in aui library we have only to events onSelect and onChange) of other normal text field.

I am trying in thsi way but still not getting any value.

 1<form   action="<liferay-portlet:actionURL name="saveForm"  />"
 2     id="<portlet:namespace />sampleForm"
 3    method="post"  enctype="multipart/form-data"  name="<portlet:namespace />sampleForm">
 4<aui:input name="firstName"  id="firstName" />      /* this is autocomplete field*/
 5
 6<aui:input name="lastName"  onChange="myFunction()"/>
 7.
 8.
 9.
10.
11
12</form>


 1<script type="text/javascript" language="javascript">
 2    
 3function myFunction(){
 4   alert("in----------");
 5   alert(document.getElementByName("firstName").value());
 6 alert(document.getElementById("firstName").value());
 7}
 8
 9</script>


Can anybody show me a best way to get value of autocomplete field ?
Pankaj Kathiriya
RE: Get value of autocomplete field onchange of other textfields
October 26, 2013 3:37 AM
Answer

Pankaj Kathiriya

Rank: Liferay Master

Posts: 548

Join Date: August 4, 2010

Recent Posts

Use
1document.getElementById('<portlet:namespace/>firstName').value