Click here to Skip to main content
16,022,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

When I am browsing the image with long name that is disturbing the UI, how can I short the name of file to display on UI.


Thanks
Posted

1 solution

Shortening the name means that the user won't be able to know true name of the image (file). This hardly can be acceptable. You can show the full name in a UI element which is horizontally scrollable. This is the usual UI style. For a text control, this is the default. You can make this control read-only.

The solution with input would have one problem: the scroll bar is not shown, so there is no indication of the fact that the name is not fully shown. More sophisticated solution could be based on textarea, and the style should be far from default. We need to make it a single-row input, prevent wrapping and show the scroll bar. Here is the simple code sample showing these effects:
HTML
<html>
   <head>
      <title>Single line with scroll bar</title>
      <style type="text/css">
         textarea {
            overflow-x: scroll; 
            white-space: nowrap;
            resize: none;
            width: 10em; /* for example */
         } 
      </style>
   </head>
<body>

<textarea rows="1" readonly="readonly">Some long, very long name, really long</textarea>

</body>
</html>


—SA
 
Share this answer
 
v3
Comments
DT_2 18-Jan-16 4:47am    
Thanks Sergey for your comment.

Below link has done my job.

http://stackoverflow.com/questions/26396468/how-to-set-text-box-value-to-upload-filename-using-javascript

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900