留言板

Autofields UploadField Problem

Bob Kostas,修改在12 年前。

Autofields UploadField Problem

New Member 帖子: 10 加入日期: 12-4-10 最近的帖子
When i press (+) button the duplicated fields are empty(OK) except the upload file field(Wrong) which has the same filepath as the above block. Why this is happening?


My code:

<aui:fieldset id="annexes">
<div class="lfr-form-row lfr-form-row-inline">
<div class="row-fields">
<table align="center">

<tr>
<td><aui:input label="Τίτλος" type="text" name="annexTitle1"
value="" size="50" /></td>
</tr>
<tr>
<td><aui:input label="Αρχείο" type="file" size="50"
name="annexFile1"></aui:input></td>
</tr>
</table>
</div>
</div>
<aui:input name="annexesIndexes" type="hidden" value="1" />
</aui:fieldset>

<aui:script use="liferay-auto-fields">
new Liferay.AutoFields(
{
contentBox: '#<portlet:namespace />annexes',
fieldIndexes: '<portlet:namespace />annexesIndexes'
}
).render();
</aui:script>
Bob Kostas,修改在12 年前。

RE: Autofields UploadField Problem

New Member 帖子: 10 加入日期: 12-4-10 最近的帖子
it happens only with firefox
Bob Kostas,修改在12 年前。

RE: Autofields UploadField Problem

New Member 帖子: 10 加入日期: 12-4-10 最近的帖子
I fixed that. I modified auto_fields.js

_clearForm: function(node) {
node.all('input, select, textarea').each(
function(item, index, collection) {
var type = item.getAttribute('type');
var tag = item.get('nodeName').toLowerCase();

if (type == 'text' || type == 'password' || type == 'file' || tag == 'textarea') {
item.val('');
}
else if (type == 'checkbox' || type == 'radio') {
item.set('checked', false);
}
else if (tag == 'select') {
item.set('selectedIndex', -1);
}
}
);
}