views:

64

answers:

3

Hi, I have a screen as shown in the below image. Once a file is selected, I need to display the selected file name with complete path in the "Import Files".alt text

I suppose, it has be done with the javascript. Someone, please give me an idea how to achieve this functionality.

+2  A: 

I hope.
this is the table structure, so perform following steps
1)let user browse and select the file.
2)on click of add files button add the text from file input to table's row here is the help

org.life.java
Thanks for the answer. Actually, the 'Add Files' button is for different purpose. The requirement is like - 'Import File' grid is already there with empty values for both the 'Serial Number' and 'File to Import' columns. Once, an user selects a file by clicking the browse button, that file path should appear in the 'File to Import' column.
Raj
@Raj. Try ValueChange over that FILE INPUT component and try to add it
org.life.java
+1 Why the down vote on this answer? Down voters should leave comments.
J.Hendrix
Thanks @ J.Hendrix
org.life.java
+1  A: 

You can dynamically generate <tr> element to represent row in your table. For example:

function AddRow(int serialNumber, string fileName)
{
   var table = document.getElementById('tableId');
   table.innerHtml += "<tr><td>" + serialNumber + "</td><td>" + fileName+ "</td></tr>
}

Also the truth is that you cannot intercept full file path in javascript. You can only get a filename and put it in your table.

You can fire it as an event on the onchange event of the input:

<input type="file" onchange="javascript:AddRow(serialNumber, this.value); serialNumber++;">

Also you have to declare your serial number property somewhere on the top of your file f.e.

<script type="text/javascript">var serialNumber = 0;</script>
ŁukaszW.pl
Nice.. thanks for a down vote for no reason.
ŁukaszW.pl
Raj
Check the update ;)
ŁukaszW.pl
+1 Why the down vote? Seems like a legit answer to me?
J.Hendrix
Raj
It wasn't to you... It was for a downvoter.. There is a good rule that you should write the reason why you are downvoting - someone make a downvote without telling why ;)
ŁukaszW.pl
Oh I see. Thanks for the info. Bye the way, I have tweaked your code a little. And, it's working now. Thanks again.
Raj
Pleasure is mine ;) Good luck with this project ;)
ŁukaszW.pl
Yeah thanks.. :)
Raj
A: 

It isn't possible.

Codler
Now your answer is the best I've ever seen here.. It's not helpful at all.. we know that he cannot put full path to the table, but this is not a reason to not show him what possibilities he have.
ŁukaszW.pl