Reset Switch to before state

3 posts, 1 answers
  1. Answer
    Danilo
    Danilo avatar
    2 posts
    Member since:
    Aug 2013

    Posted 06 Sep 2013 Link to this post

    Hi,

    I am building an app, with a mobile switch, but i can not reset it to default state. 
    The value is resetted, but the graphic shows it still on "J", the onlabel.
    How can I reset this switch completely without removing it from DOM??
    Like if it is off for default, it should be off after reset, for it is on for default, it should reset to on, independed on what state it actually is.
    <label for="bb" id="ms">Bla or blub?
    <input type="checkbox" data-role="switch" id="BB-switch" name="bb" data-change="switchChange" class="rrform" data-off-label="N" data-on-label="J" value="false"/>
    </label>
    // reset whole formular to default settings
      function reset(){
            var $res = $("#rrform").get(0);
            $res.reset();
            $("#MWST-switch").removeAttr('checked');
       }
    reset();
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 09 Sep 2013 Link to this post

    Hello Danilo,

    If I understand you correctly, your case is similar to this example. You may call the refresh method after the form has been reset.

    Regards,
    Petyo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Danilo
    Danilo avatar
    2 posts
    Member since:
    Aug 2013

    Posted 09 Sep 2013 Link to this post

    Hi Petyo,
    That is exactly what i was looking for, big thanks! The only thing that doesn't refresh is the value, but that is ok by adding it extra. I am still very new to programming, so I thank you very much!
Back to Top