Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • RolandWolters 42 posts 63 karma points
    Jan 26, 2011 @ 10:30
    RolandWolters
    0

    Actual Max length of <input type="text"> element

    I have this textfield with maxlenght set to 255. The users' input will be displayed on the frontend. If the user has entered a link in the text, the actual displayed text is a lot shorter then the allowed 255 chars.

     

    How can I let the user input text that will be DISPLAYED as max255 chars

     

    Example: say maxlength=50

    input: My <a href='our.umbraco.org'>umbraco</a> is great!
    length: 50 chars

    desplayed like this: This is umbraco!
    length: 16 chars

    I want the user to be able to enter text that will be displayed as max 50 char

     

    Well, actually, I don't care, but my customer does.

     

    Any idea's ?

     

  • Sjors Pals 617 posts 270 karma points
    Jan 26, 2011 @ 11:25
    Sjors Pals
    0

    Is XSLT substring function an option?

    substring (string, number, number?)

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 26, 2011 @ 11:34
    Chriztian Steinmeier
    0

    How do they enter links? Do the input the full HTML link, or just some kind of Markdown/Textile variant?

    Since the actual text length can not be expressed as (entered text + X chars) it makes it hard to define a set maximum on the field...

    The StripHtml() function in umbraco.library would be able to help you calculate, though...

    /Chriztian 

  • RolandWolters 42 posts 63 karma points
    Jan 26, 2011 @ 11:57
    RolandWolters
    0

    Oh yeah, Striphtml is a good idea actually... but it would have to be called on every change of the textbox's content.... could be done by a ajax call... hmmm

     

Please Sign in or register to post replies

Write your reply to:

Draft