Copied to clipboard

Flag this post as spam?

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


  • Matt Brown 62 posts 174 karma points
    Aug 08, 2016 @ 12:17
    Matt Brown
    0

    Need to create dropdown list in backend with value

    I need to create a select list for my content people to be able to select one option off a list of options. When they see VOLVO below and select it, it should set the value to "1"

    I cannot figure this out. It seems so very basic that your value and label for the option would be different yet I can't find a single thing to tell me how to do this.

    <select>   
      <option value="1">Volvo</option>   
      <option value="2">Saab</option>   
      <option value="3">Mercedes</option>   
      <option value="4">Audi</option> 
    </select>
    
  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Aug 08, 2016 @ 12:50
    Dennis Aaen
    0

    Hi Matt,

    Perhaps this documentation can help you a step further to do what you are trying to do.

    https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/DropDown-List-Publishing-Keys

    Hope this helps,

    /Dennis

  • Matt Brown 62 posts 174 karma points
    Aug 08, 2016 @ 15:51
    Matt Brown
    0

    Thank you very much Dennis, however I don't see how it helps. It shows me how to add the drop down options, but not the values which appear to be simply values starting at "0". I want the first option text to be "Emmit" and the value in the list for it to be "1234-234a".

    I don't see how you can only have one set of choices when there needs to be a key/value pair arrangement.

    I get this:

    enter image description here

    All that is fine, but these are the text labels between the option tags, and I need to assign a different value to each option value attribute.

    The point is that I want the label to be human readable like these are, but I want the value to be some content that is not just some index number, like in my case, "/67" Now it is 0,1,2, etc.

    Do I really need to build a case statement in Javascript to do the work changing the values in the browser? That seems awfully backwards.

    I want this:

    <select>   
      <option value="1234-243s">Volvo</option>   
      <option value="aYr623">Saab</option>   
      <option value="j888">Mercedes</option>   
      <option value="Matt-1234">Audi</option> 
    </select>
    
  • Amir Khan 1282 posts 2739 karma points
    Aug 08, 2016 @ 23:33
    Amir Khan
    0

    One way around this would be to use nuPickers then you could set the prevalue source to be a set of content nodes. You can add any properties to those nodes you'd like and use those properties as you see fit. It will store the ID of the node by default I believe.

    -Amir

Please Sign in or register to post replies

Write your reply to:

Draft