Results 1 to 2 of 2
- 09-03-2009, 06:50 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 1
- Rep Power
- 0
retain value of input type file in a jsp file while being dynamically generated
i have a jsp page where i have a input type file and i m allowing the user to browse files. i have one such input on jsp and the rest i m generating dynamically by javascript.
this is my jsp code:
<div id="labelContainer" style="display:inline">
<table align="center">
<tr>
<td align="left"><input type="text" id="label0" name="label0" size="15"></td>
<td align="center"><input type="file" id="filePath0" name="browsetrainset0"></td>
<td id="addlabel" ><img src="../images/add.png" title="Add Label" onclick="addLabel()"></td>
<td id="removelabel"><img src="../images/remove.png" title="Remove Label" onclick="removeLabel('labelDiv0')"></td>
</tr>
</table>
</div>
and this is my javacsritp code:
function addLabel(){
var text="";
lCount++;
text+=("<table id='labelDiv"+lCount+"' align='center'>");
text+=("<tr>");
text+=("<td align='left' style='display:none'><input type='checkbox' checked='true' name='labelchkbox'/></td>");
text+=("<td align='left' id='label'><input type='text' id='label"+lCount+"' name='label"+lCount+"' size='15'></td>");
text+=("<td align='center'id='filePath' ><input type='file' id='filePath"+lCount+"'name='browsetrainset"+lCoun t+"'></td>");
text+=("<td id='addlabel' ><img src='../images/add.png' title='Add Label' onclick='addLabel()'></td>");
text+=("<td id='removelabel'><img src='../images/remove.png' title='Remove Label' onclick=\"removeLabel('labelDiv"+lCount+"')\"></td>");
text+=("</tr>");
text+=("</table>");
document.getElementById("labelContainer").innerHTM L+=text;
}
but i m not able to retain the value of the file path i browse, on the jsp page once i click the add label and generate another input type file.
I am using IE7. Please tell me how to reatin the value of the browsed files so that i can use them further.
- 09-27-2009, 02:21 AM #2
i remember something awful about HTML file tags. they don't retain their value between form / page loads, like from validating or page 2
another problem related we couldn't find away to change the text and appearance on the browse buttons beside the file widget. the file tag represents a UI control that is very specific to the browser. it is somehow handled natively and in a way that invokes the native file selector dialog.
I think the only way to have true file selector control is to not use one, but then you get into complex Javascript widgets, or a file upload applet. Facebook seems to do it right somehow.
Similar Threads
-
Getting access denied error while importing file using input type="file" with IE7
By sarang1 in forum Advanced JavaReplies: 6Last Post: 02-10-2011, 09:55 AM -
count character in text file as input file
By aNNuur in forum New To JavaReplies: 7Last Post: 03-25-2010, 04:01 PM -
loading .properties file dynamically
By nanaji in forum Advanced JavaReplies: 3Last Post: 03-17-2009, 03:40 AM -
getting dynamically generated valus
By abhiN in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 03-29-2008, 10:58 AM -
passing dynamically generated values
By abhiN in forum Advanced JavaReplies: 1Last Post: 01-20-2008, 03:21 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks