Wrap long-text in drop-down list?

前端 未结 7 1125
轻奢々
轻奢々 2021-01-19 15:19

I have legibly long text in a drop-down list on my asp.net page. it violates the UI boundary and goes beyond the allocated region of UI.

Is there anyway I can wrap [

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-19 15:37

    An example from a Coldfusion site where I needed a list of titles to select from and lengths were up to 200 characters. The select options are looped from a query and divided at a full word point if the text string is too long, both strings get the same option value. A character pattern is appended to the second string, in this case "_ _". Use js to look for the pattern in the text of the selection. If pattern is found reset seletectedIndex by -1 so user only sees the first line of the text if they choose the second.

    js:
    function checkSelectedValue(str)
    {
    var val = str.options[str.selectedIndex].text;
    var indx = str.selectedIndex;
    var patt = /_ _/g;
    var result = patt.test(val);
    if(result){
        str.selectedIndex = str.selectedIndex - 1;
    }
    }
    
    cf:
    
    
    
    
    
    
    
    
      
      
      
      
    
    
      
      
      
    
    
    
    

提交回复
热议问题