Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sarah L Farley
Autocomplete Street 1 on users_admin/addresses.jsp
November 29, 2012 10:33 AM
Answer

Sarah L Farley

Rank: Junior Member

Posts: 37

Join Date: May 6, 2009

Recent Posts

Hi,

I am writing a hook for the portlet users_admin which will allow the user to start typing a building name and the field will autocomplete.

I would like to assign this field to the autocomplete field
1                                    <aui:input fieldParam='<%= "addressStreet1_" + addressesIndex %>' id='<%= "addressStreet1_" + addressesIndex %>' name="street1" />


I have the following javascript code:

1AUI().ready('aui-autocomplete', function(A) {
2        var building = [ <!-- insert my building list -->];
3        var autoComplete = new A.AutoComplete( { contentBox: '#<portlet:namespace />addressStreet1_0', dataSource: building, matchKey: 'name', typeAhead: true, schema: { resultFields: ['key', 'name', 'description'] } } ) .render(); });
4//-->
5</script>


Howerever, it seems to only display the field if I have the div tag in place
1     <div id="<portlet:namespace /><%= "addressStreet1_" + addressesIndex %>" >


Even then, when I submit the form, it says Street 1 is invalid.

Any suggestions?
Sarah L Farley
RE: Autocomplete Street 1 on users_admin/addresses.jsp
November 29, 2012 10:34 AM
Answer

Sarah L Farley

Rank: Junior Member

Posts: 37

Join Date: May 6, 2009

Recent Posts

My full code for the div tag is this:

1   <div id="<portlet:namespace /><%= "addressStreet1_" + addressesIndex %>" >
2               
3                                    <aui:input fieldParam='<%= "addressStreet1_" + addressesIndex %>' id='<%= "addressStreet1_" + addressesIndex %>' name="street1" />
4               
5            </div>