Copied to clipboard

Flag this post as spam?

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


  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 10, 2010 @ 18:13
    Douglas Robar
    1

    "Please choose one" non-selectable default item in dropdown list?

    Is there any way to set a default value in a dropdown list?

    I would like the first field to say "please choose one". It isn't really a valid selection just a notification to the user that they need to select one of the items in the list. So not only should there be a default item but it should not be selectable.

    I added a property desciprtion for now, which helps, but I'd prefer to have it displayed as the first non-selectable item (default).

    How would this be done?

    cheers,
    doug.

  • Amir Khan 1287 posts 2744 karma points
    May 10, 2010 @ 18:47
    Amir Khan
    0

    You could add this to the item you'd like to be disabled with javascript:


    <option disabled="disabled">please choose one</option>
  • Amir Khan 1287 posts 2744 karma points
    May 10, 2010 @ 18:51
    Amir Khan
    0

    Sorry, forgot one bit: <option disabled="disabled" selected="selected">please choose one</option>

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 10, 2010 @ 23:19
    Douglas Robar
    0

    If I were building the list myself I could do this easily. It isn't the markup I'm struggling with but how to get Contour and prevalues to create that markup.

    Any ideas?

    cheers,
    doug.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 12, 2010 @ 10:38
    Douglas Robar
    0

    Any ideas?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 12, 2010 @ 11:30
    Sebastiaan Janssen
    0

    I don't have enough experience with Contour to help you, however, it could quite easily be done with some jQuery. 

  • Comment author was deleted

    May 12, 2010 @ 13:58

    Hi Doug,

    We should add an easy way of making that possible but for now it should be simple to take the existing dropdown sourcecode and set the text of the first option to "please choose one"

    Sourcecode for all default components including fieldtypes can be found here

    http://our.umbraco.org/projects/umbraco-contour-shared-source

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 12, 2010 @ 14:01
    Douglas Robar
    0

    Thanks, Tim. Hope it can be added soon.

    I was afraid it would require a source edit. I may look into jQuery as Sebastiaan suggested.

    cheers,
    doug.

  • Amir Khan 1287 posts 2744 karma points
    May 28, 2010 @ 17:10
    Amir Khan
    0

    Hey Doug, were you able to find a solution for this?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 28, 2010 @ 18:00
    Douglas Robar
    0

    No, it wasn't worth the time/money to the client for the project that wanted it.

    Do let us know if you resolve it!

    cheers,
    doug.

  • Amir Khan 1287 posts 2744 karma points
    May 28, 2010 @ 20:20
    Amir Khan
    1

    I'm not 100% how Contour applies value attributes to dropdown lists, but here's the way you'd do it with jquery.

    list:

    <select name="myList" id="myList">
          <option value="pleaseSelect">Please select one</option>
          <option value="optOne">One</option>
          <option value="optTwo">Two</option>
          <option value="optThree">Three</option>
          <option value="optFour">Four</option>
    </select>

    jquery, dont forget to include the library:

    <script type="text/javascript">
    $(document).ready(function(){
    $("#myList option[value='pleaseSelect']").attr({
    'disabled': 'true',
    'selected': 'true'
    });
    });
    </script>
  • Tim 66 posts 89 karma points
    Nov 16, 2011 @ 03:11
    Tim
    0

    Please guys could you add an option to contour to do this.

    Amir - Thanks for your solution it worked, though i have an empty <option></option> above  'please select' so its possible for the user to select a blank option, anyhow its close enough for me. Thanks very much for putting a quick fix to this.

  • Julia 9 posts 24 karma points
    Dec 07, 2011 @ 12:59
    Julia
    0

    Ok, Trying to get answer form Doug here;)

    Hi Douglas,

    My question goes to you, hope you are still there after the last year old answer;)

    My question is about archiving old info, like folders from meetings, presentations, news articles by months and year.

    What I mean you can see on our web http://www.nucc.no/activities.aspx

    As you see there are lots of folders from previous meetings in 2011, 2010 and 2009. How can make accessible archive for those folders? Like when people want to go to 2011 folder and see the list of meetings. Im not a professional IT person so please try to use easy language when explaining:)

    We use umbraco version 4.5.2.

    Hope to hear from you soon.

    Thanks

    Julia

     

Please Sign in or register to post replies

Write your reply to:

Draft