469,331 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

Extending size according to content

22
I'm trying to adjust the size of a templatefield box so it shows all the data entered after Updating instead of having scroll bars and having to go up and down to see all the data in that field.

Any ideas?

Thanks!
Oct 25 '07 #1
2 1030
jhardman
3,406 Expert 2GB
You could probably make a good approximation of the size you need by using len(). You would need an empirical formula (one based on trial and error, rather than starting form basic principles) to calculate size. Something like this might work:
Expand|Select|Wrap|Line Numbers
  1. if len(request("textInput")) > 400 then %>
  2.    <textarea cols="75" rows="<%=5+int((len(request("textInput"))-400)/75)%>">
  3. <%
  4. else %>
  5.    <textarea cols="75" rows="5">
  6. <%
  7. end if %>
Only an approximation will do, font sizes are notoriously sizes set by browsers rather than the HTML code, especially in cases like inside textareas. Let me konw if this helps.

Jared
Oct 26 '07 #2
Barno77
22
Thanks for the quick reply and let you konw it goes! Appreciate it!
You could probably make a good approximation of the size you need by using len(). You would need an empirical formula (one based on trial and error, rather than starting form basic principles) to calculate size. Something like this might work:
Expand|Select|Wrap|Line Numbers
  1. if len(request("textInput")) > 400 then %>
  2.    <textarea cols="75" rows="<%=5+int((len(request("textInput"))-400)/75)%>">
  3. <%
  4. else %>
  5.    <textarea cols="75" rows="5">
  6. <%
  7. end if %>
Only an approximation will do, font sizes are notoriously sizes set by browsers rather than the HTML code, especially in cases like inside textareas. Let me konw if this helps.

Jared
Oct 29 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Petre Huile | last post: by
4 posts views Thread by Daniel Fugmann | last post: by
4 posts views Thread by Matt | last post: by
5 posts views Thread by vbgunz | last post: by
4 posts views Thread by Ian Richardson | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.