All: I have a drop down box on a cfform that has very long lines of data. Due to the nature of the data, I can not shorten the amount of characters in the SQL table. I have tried to use the Wrap function in my output, but it is cutting off anything after the limit I gave it. It should be wrapping to the next line. Can anyone help me with this? Here is part of my code. <td> <select name="HAZ_MAT_NME" size="1" class="smallbold" onBlur="setSelectedIndex(this)" onKeyDown="return setSelectedIndex(this)"> <option value="" selected></option> <cfoutput query="hazmatnme"> <cfset HazWrap=#hazmatnme.HAZ_MAT_NME#> <option value="#HazWrap#">#Wrap(HazWrap, 25, False)#</option> </cfoutput> </select> </td> Thanks!
Would truncating the data after a certain length be a solution for you? Or do you have to display it all and wrap it?
It needs to be wrapped. From what I've been reading it's really not possible. I've been told even if you do "wrap" the text, it does not indent the 2nd line which makes the dropdown hard to read.
Two ideas: 1. Break the single option into multiple options with the same value. Optionally indent it and add a divider. So: <option value="1">Some Long Text</option> Becomes: <option value="1">Some</option> <option value="1"> Long</option> <option value="1"> Text</option> <option>-----------------</option> 2. You can implement a custom form element in Ajax or AS3.
Thanks for the great idea! We used something similar thanks to you and trimmed it. It works!!! Your the bestest
This is what I used... <cfif #len(query.name)# gt 75> <option value="#query.name#">#Left(query.name, 75)#</option> <option value="#query.name#">#Right(query.name, 75)#</option> <option value="">-------------------</option> <cfelse> <option value="#query.name#">#query.name#</option> </cfif> Any idea on how to get it to break it at the last space in the text? Right now it's taking the left 75 charachters and the right 75 characters and putting it on two lines. The problem is if it is less than 150 characters in the line it is duplicating data and breaking words.