Switch not working

Support MB Settings Page Switch not working

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41509
    WillWill
    Participant

    Hi,

    I have a switch field which work perfectly previously. I had created a "view" with the following code:
    {{ mb.checkbox( site.vacation.vacation_mode, 'On', 'Off' ) }}

    Whenever I "toggle on" or "toggle off", the view only show "Off". Previously was working with no issue. Kindly assist.

    #41517
    PeterPeter
    Moderator

    Hello Will,

    Please use this code in View to get the switch value and output the field label Yes/No

    {% set switch = mb.rwmb_meta( 'vacation_mode', { object_type: 'setting' }, 'vacation' )  %}
    {{ mb.checkbox( switch, 'Yes', 'No' ) }}

    Assume that: vacation is the option name and vacation_mode is the switch field ID.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.