<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Details were missing, so I just tried this over here, and don't see
    any immediate issues:<br>
    <br>
    <font face="monospace">diff --git
      a/vehicle/OVMS.V3/components/ovms_webserver/src/web_framework.cpp
      b/vehicle/OVMS.V3/components/ovms_webserver/src/web_framework.cpp<br>
      index 913510c3..7d756f01 100644<br>
      ---
      a/vehicle/OVMS.V3/components/ovms_webserver/src/web_framework.cpp<br>
      +++
      b/vehicle/OVMS.V3/components/ovms_webserver/src/web_framework.cpp<br>
      @@ -361,7 +361,7 @@ void PageContext::input_slider(const char*
      label, const char* name, int size, co<br>
             "<label class=\"control-label col-sm-3\"
      for=\"input-%s\">%s:</label>"<br>
             "<div class=\"col-sm-9\">"<br>
               "<div class=\"form-control slider\"
      data-default=\"%g\" data-reset=\"false\""<br>
      -        " data-value=\"%g\" data-min=\"%g\" data-max=\"%g\"
      data-step=\"%g\">"<br>
      +        " data-value=\"%g\" data-min=\"%g\" data-max=\"%g\"
      data-step=\"%g\" data-checked=\"%s\">"<br>
                 "<div class=\"slider-control form-inline\">"<br>
                   "<input class=\"slider-enable\" type=\"%s\" %s>
      "<br>
                   "<input class=\"form-control slider-value\" %s
      type=\"number\" style=\"width:%dpx;\""<br>
      @@ -380,6 +380,7 @@ void PageContext::input_slider(const char*
      label, const char* name, int size, co<br>
           , _attr(name)<br>
           , label<br>
           , defval, value, min, max, step<br>
      +    , (enabled != 0) ? "true" : "false"<br>
           , (enabled < 0) ? "hidden" : "checkbox" // -1 => no
      checkbox<br>
           , (enabled > 0) ? "checked" : ""<br>
           , (enabled == 0) ? "disabled" : ""</font><br>
    <br>
    <br>
    I've tested this quick & dirty on the Wifi config page by
    testing for the default value, that worked as expected.<br>
    <br>
    Regards,<br>
    Michael<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 27.12.22 um 11:32 schrieb Michael
      Geddes:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAH0p7uLwFQBTAfF+Wf7fjwzQ=-3DzZtOHx+b-1s2wCiTMvuVWg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Unfortunately that doesn't work (detail below). 
        The code I had worked much better from the  framework generated
        input box.. but I'm not sure how to test it in a plugin.
        <div><br>
        </div>
        <div>I have the 2 sliders with checkboxes on <a
            href="http://ov.ms/#/xkn/battery" moz-do-not-send="true"
            class="moz-txt-link-freetext">http://ov.ms/#/xkn/battery</a> 
          (<a href="http://ov.ms" moz-do-not-send="true">ov.ms</a> is a
          local network alias for my ovms box).</div>
        <div>I have one slider unchecked and one checked.</div>
        <div><br>
        </div>
        <div>Just putting data-checked as an attribute in the generated
          code caused both sliders to be disabled on first load!</div>
        <div><br>
        </div>
        <div>//.ichael</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Tue, 27 Dec 2022 at 15:54,
          Michael Balzer <<a href="mailto:dexter@expeedo.de"
            moz-do-not-send="true" class="moz-txt-link-freetext">dexter@expeedo.de</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div> Michael,<br>
            <br>
            I remember I changed the slider enable/disable control
            scheme from reading the checkbox state to using the data
            attribute / option for a reason, but I cannot remember
            exactly which now. I think it was to get consistent dynamic
            controllability.<br>
            <br>
            My initial commit was
            ec1a874dadce01e8bd588c20115d890acd9149c2, which used the
            checkbox state. A few days later in
            91ed78a3d7ac5392eadd65be026a1a0fc77a611e I changed this to
            using the `checked` option, but missed adding `data-checked`
            to `PageContext::input_slider()` accordingly.<br>
            <br>
            Sliders using the enable/disable feature at that time only
            appeared in plugins/pages doing dynamic initialization, so
            this didn't become visible. Plugins normally create sliders
            by data attributes or init options, not by explicit markup.<br>
            <br>
            TL;DR: I think the fix would probably better be to add the
            missing `data-checked` to the markup created by
            `PageContext::input_slider()`.<br>
            <br>
            Regards,<br>
            Michael<br>
            <br>
            <br>
            <div>Am 27.12.22 um 04:40 schrieb Michael Geddes:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Right, so that didn't work if the check-box
                was disabled (like in wifi)- but this does seem to work!<br>
                <div><br>
                </div>
                <div>    var $sld = $(this).closest('.slider'), $cbi =
                  $sld.find('.slider-enable'), data = $.extend({
                  checked: ($cbi.prop("type") === "hidden" ||
                  $cbi.prop("checked")) }, $sld.data());<br>
                </div>
                <div><br>
                </div>
                <div>//.ichael</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Tue, 27 Dec 2022 at
                  11:04, Michael Geddes <<a
                    href="mailto:frog@bunyip.wheelycreek.net"
                    target="_blank" moz-do-not-send="true"
                    class="moz-txt-link-freetext">frog@bunyip.wheelycreek.net</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">
                  <div dir="ltr">
                    <div>Hi all,<br>
                    </div>
                    <div>I've noticed that if you create a 'slider'
                      widget with a checkbox that if it's unchecked when
                      it first loads, then the slider is enabled. If you
                      check/uncheck then the slider is disabled. Or at
                      least that's what I seen in google chrome.</div>
                    <div><br>
                    </div>
                    <div>I'm really not familiar with NodeJS, but this
                      _seems_ to fix the problem:</div>
                    <div><br>
                    </div>
                    <div>Does this fix make sense?  If so - I'll do a
                      p/r for it.</div>
                    <div><br>
                    </div>
                    <div>//.ichael </div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    * Slider widget plugin<br>
                      */<br>
                     <br>
                     $.fn.slider = function(options) {<br>
                       return this.each(function() {<br>
                    -    <font color="#ff0000">var $sld =
                      $(this).closest('.slider'), data = $.extend({
                      checked: true }, $sld.data());</font><br>
                    + <font color="#38761d">   var $sld =
                      $(this).closest('.slider'), $cbi =
                      $sld.find('.slider-enable'), data = $.extend({
                      checked: $cbi.prop("checked") }, $sld.data());</font><br>
                         var opts = (typeof options == "object") ?
                    options : data;<br>
                         // init?<br>
                         if ($sld.children().length == 0) {<br>
                           var id = $sld.attr('id');<br>
                           $sld.html('\<br>
                  </div>
                </blockquote>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
OvmsDev mailing list
<a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">OvmsDev@lists.openvehicles.com</a>
<a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
            </blockquote>
            <br>
            <pre cols="72">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
          </div>
          _______________________________________________<br>
          OvmsDev mailing list<br>
          <a href="mailto:OvmsDev@lists.openvehicles.com"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">OvmsDev@lists.openvehicles.com</a><br>
          <a
            href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
  </body>
</html>