1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to add radio buttons in Options page

Discussion in 'XenForo Development Discussions' started by AndyB, Jan 21, 2015.

  1. AndyB

    AndyB Well-Known Member

    In my Bookmark add-on I currently have the following four selections in the Options page:


    This works, but it's confusing to admins because all four selection can be selected. What I would like to do is make the first two selection be radio Buttons and make the last selection Radio Button.

    So how do I set up the edit page?

    Edit Format: Radio Buttons
    Data Type: Array
    Array Sub-Options:

    What should I enter into the Array Sub-Options field?

    Thank you.
  2. Chris D

    Chris D XenForo Developer Staff Member

    As a collection of radio buttons can only have a single value, a data type of "Array" won't work. Only one radio button can be selected at a time, hence only one value can be stored.
  3. AndyB

    AndyB Well-Known Member

    Hi Chris,

    I would like to have the following two options, is this possible?

    () Post Date
    () Bookmark Date


    () Sort Descending
    () Sort Ascending
  4. Chris D

    Chris D XenForo Developer Staff Member

    That would require two options.

    One that gives two radio buttons for Post Date and Bookmark Date and another that gives two radio buttons for Sort Descending and Sort Ascending.
  5. AndyB

    AndyB Well-Known Member

    Yes exactly what I would like to do. The problem is I have no idea how to set these fields:

  6. Chris D

    Chris D XenForo Developer Staff Member

    As stated, it can't be an array because radio buttons would output a single value.

    With that in mind, you should be able to choose an appropriate data type; and if it can't be an array, then maybe Array Sub-Options doesn't need to be set...
  7. AndyB

    AndyB Well-Known Member

    So would I put something into the Format Parameters?
  8. Chris D

    Chris D XenForo Developer Staff Member

    Look at how an existing radio button option is set up:

  9. AndyB

    AndyB Well-Known Member

    Thanks, Chris. I forgot I could look at the edit of existing radio buttons for the clue I needed.



Share This Page