This is a migrated thread and some comments may be shown as answers.

Reset Switch to before state

2 Answers 342 Views
Switch (Mobile)
This is a migrated thread and some comments may be shown as answers.
Danilo
Top achievements
Rank 1
Danilo asked on 06 Sep 2013, 12:16 PM
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 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 09 Sep 2013, 08:12 AM
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!
0
Danilo
Top achievements
Rank 1
answered on 09 Sep 2013, 01:12 PM
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!
Tags
Switch (Mobile)
Asked by
Danilo
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Danilo
Top achievements
Rank 1
Share this question
or