Fórumok

How can I using Liferay Auto Field in my custom portlet?

thumbnail
behnaz eslami, módosítva 10 év-val korábban

How can I using Liferay Auto Field in my custom portlet?

Junior Member Bejegyzések: 54 Csatlakozás dátuma: 2011.11.14. Legújabb bejegyzések
In my custom portlet this is my view.jsp :

<h1>Liferay auto fields example</h1>
<form action="" method="post" name="LiferayAautoFieldForm">
<fieldset><legend>Phone Numbers</legend>
<div id="phone-fields">
<div class="lfr-form-row lfr-form-row-inline">
<div class="row-fields">
<input id='phoneNumber0' name="phoneNumber0" label="Phone Number" />
<select id="phoneTypeId0" name="phoneTypeId0" label="Type">
<option value="11006" label="Business">Business</option>
<option value="11007" label="Business Fax">Business Fax</option>
<option value="11008" label="Mobile Phone">Mobile Phone</option>
<option value="11009" label="Other">Other</option>
<option value="11011" label="Personal">Personal</option>
</select>
</div>
</div>
</div>
</fieldset>
<layout>
<column>
<button type="submit" value="Save Phone Numbers" name="SavePhoneNumbers">Save Phone Numbers</button>
</column>
</layout>
</form>


I want to use new Liferay.AutoFields among <aui-script> tag for increasing these two fields. I use this code in [i]view.jsp :

<aui:script use="liferay-auto-fields">
new Liferay.AutoFields(
{
contentBox: '#phone-fields',
fieldIndexes: 'phonesIndexes'
}
).render();
</aui:script>



It has problem because when I add a lot of these two field and then remove them on by one, id that recognizes every input becomes mistake. Also When I just have one row (bare-field) by clicking on (-) button the id of phoneNumber0 become mistake, actually it increases while it has to be phoneNumber0
How can I solve this issue???????????
Please guide me.

Thanks.
thumbnail
Daniele Baggio, módosítva 10 év-val korábban

RE: How can I using Liferay Auto Field in my custom portlet?

Expert Bejegyzések: 336 Csatlakozás dátuma: 2008.12.05. Legújabb bejegyzések
Have you read liferay portal code about the usage of this component?
You find the right way to use it taking as example the user account phones section.
Now I don't have under my hand another example to help you.
asif aftab, módosítva 9 év-val korábban

RE: How can I using Liferay Auto Field in my custom portlet?

Regular Member Bejegyzések: 123 Csatlakozás dátuma: 2013.09.02. Legújabb bejegyzések
May be this is helpful for you.
http://liferayasif.blogspot.in/2014/09/liferay-auto-fields-adding-multiple.html
liferay auto fields
But if I provide button inside that div then its id is remain constant in each new row, means its id is not increasing as similar to other elements.
If any know about it then plz help me.
Thanks
thumbnail
Vipin Bardia, módosítva 9 év-val korábban

RE: How can I using Liferay Auto Field in my custom portlet?

Regular Member Bejegyzések: 162 Csatlakozás dátuma: 2011.02.28. Legújabb bejegyzések
Hi,

Below link surely helps you -

http://www.liferaysavvy.com/2013/10/liferay-auto-fields.html
thumbnail
behnaz eslami, módosítva 9 év-val korábban

RE: How can I using Liferay Auto Field in my custom portlet?

Junior Member Bejegyzések: 54 Csatlakozás dátuma: 2011.11.14. Legújabb bejegyzések
Thanks for your reply