Forums

Home » Alloy UI » English

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Madasamy P
aui form fields update
December 12, 2016 11:34 PM
Answer

Madasamy P

Rank: Junior Member

Posts: 90

Join Date: July 27, 2016

Recent Posts

I have aui:form as,

<aui:column columnWidth="33" first="true">
<label id="lab">Upload Chapter</label><br><br><br>
<input type="file" name="articleFile" id="new_Btn1" multiple="true" onchange="save1()"/><br><br><br><ol class="uol1"></ol>
</aui:column>
<aui:column columnWidth="34">
<label id="lab">Upload Art Files</label><br><br><br>
<input type="file" name="artFiles" multiple="true" id="new_Btn2" onchange="save2()"/><br><br><br><ol class="uol2"></ol></aui:column>
<aui:column columnWidth="33" last="true">
<label id="lab3">Upload Supporting Files (Optional)</label><br><br>
<input type="file" name="supportFiles" multiple="true" id="new_Btn3" onchange="save3()"/><br><br><br><ol class="uol3"></ol></aui:column>

when I update the field values as,

AUI().use('aui-base','aui-io-request',function(emoticon{
var myForm = Liferay.Form.get('<portlet:namespace />fm');
var articleFile;
var supportFiles=[];

document.getElementById('myModal').style.display="none";
var files1=document.getElementById("new_Btn1").files;
var selectFile=$('input:checked').val();

for(var i=0;i<files1.length;i++){

if(selectFile==files1.name)
articleFile=files1;

else
supportFiles=supportFiles.concat(files1);
}
alert("Selected:"+articleFile);
for(var i=0;i<supportFiles.length;i++){
alert("Unselected:"+supportFiles.name);
}
myForm.set('articleFile', articleFile);
myForm.set('supportFiles',supportFiles);


But the fields not updated with the values what I was given

What I need to change my code
Byran Zaugg
RE: aui form fields update
December 20, 2016 1:11 PM
Answer

Byran Zaugg

LIFERAY STAFF

Rank: Expert

Posts: 253

Join Date: April 5, 2012

Recent Posts

For security reasons, you cannot modify the value of a file input.

I'm having difficulty finding the spec for it. But here is another discussion: http://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html