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

Spinboxes and Dropdowns in Style Properties?

Discussion in 'XenForo Development Discussions' started by Jaxel, Jul 2, 2015.

  1. Jaxel

    Jaxel Well-Known Member

    Is there a way to use spinboxes and dropdown menus in style properties?
     
  2. Jake B.

    Jake B. Well-Known Member

    Yep, you just need to use 'named template', and put the template name in the parameters box.

    Jake
     
    Dadparvar likes this.
  3. Jaxel

    Jaxel Well-Known Member

    How do I use that? When I put the template in, its missing a lot of stuff... like the title, the hint, and even the edit link.
     
  4. Jake B.

    Jake B. Well-Known Member

    You'll need to use something like this in the template:

    Code:
    <input type="hidden" name="checkboxes[]" value="{$property.property_definition_id}" />
    <xen:selectunit name="properties[{$property.property_definition_id}]" value="{$property.propertyValueScalar}" label="{$property.title}">   
        <xen:option value="1" label="{xen:phrase option_one}" />
        <xen:option value="2" label="{xen:phrase option_two}" />
        <xen:option value="3" label="{xen:phrase option_three}" />
        <xen:explain>{$property.description}</xen:explain>
        <xen:html><xen:include template="style_property_unit_extra"><xen:set var="$reset">{xen:phrase reset}</xen:set></xen:include></xen:html>
    </xen:selectunit>
    
     
  5. Jaxel

    Jaxel Well-Known Member

    Thanks mate...
     
  6. Jake B.

    Jake B. Well-Known Member

    No worries
     
  7. Jaxel

    Jaxel Well-Known Member

    Okay, that works for dropdown menus... but for spinboxes, how would I set and get min/max/step?
     
  8. Jake B.

    Jake B. Well-Known Member

    <input type="hidden" name="checkboxes[]" value="{$property.property_definition_id}" />
    <xen:spinboxunit name="properties[{$property.property_definition_id}]" value="{$property.propertyValueScalar}" label="{$property.title}" min="0" max="100" step="4" />
     
    Dadparvar likes this.
  9. Jaxel

    Jaxel Well-Known Member

    Yeah, I realise thats how you do it in templates... I was hoping to be able to do it in the style variables instead though, so I only have to make 1 template for my spinboxes, instead of having to make six... when I only need to change one variable.
     
  10. Jake B.

    Jake B. Well-Known Member

    Not sure that you can since the format parameters is already taken by the template name
     

Share This Page