Copied to clipboard

Flag this post as spam?

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


  • Profiterole 232 posts 264 karma points
    Apr 08, 2011 @ 16:20
    Profiterole
    0

    Contour field type who displays remaining character

    Hi guys,

    I'm kind a new with Contour and I want to do a textarea field type who will display the character limit and how many remaining character.

    For now, I just use a textarea and limit it with regex, but I want the user to be able so see how many character remain.

     

    Thank you for your help

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Apr 11, 2011 @ 12:28
    Tim
    0

    You'll have to create a custom field type. There's a project in the projects section that has the source for the built in ones: http://our.umbraco.org/projects/developer-tools/umbraco-contour-shared-source if you have a look through those, it should give you an idea of how to create your own. You could have a look at the source of the Umbraco DataType for limited fields: http://our.umbraco.org/projects/backoffice-extensions/char-limit (no source posted, you'll need to use Reflector or similar to get the source) and use that to with the other code to roll your own character limited field.

    Hope that helps!

    :)

  • Profiterole 232 posts 264 karma points
    Apr 13, 2011 @ 15:31
    Profiterole
    0

    Hi Tim, thank you for your reply. As you'll see, I'm discovering umbraco and contour. So, with the contour shared source I created a cs file (LimitedTextarea.cs) to suit my needs. But now, what do I do with the .cs file? Do I need to compile something or just drop it in some folder?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 04, 2011 @ 19:05
    Jeavon Leopold
    0

    Hi,

    Yes, you need to add your new class (based on the class from the shared source project) into a new class project and compile it into a DLL. Did you develop code to restrict the number of entered characters? If not the source code to the Umbraco limited character datatype mentioned by Tim above can be downloaded here This should help in developing the Contour field type.

    Thanks,

    Jeavon

  • Profiterole 232 posts 264 karma points
    May 16, 2011 @ 02:14
    Profiterole
    0

    Hi Jeavon! Since I need to compile DLL and I don't know how, I just used regex to limit character and add tooltip to say :"eh, you have 200 characters!". But thank you for your help

Please Sign in or register to post replies

Write your reply to:

Draft