0

I am developing a plugin for the Redmine project management system. To configure the plugin I am using the framework-provided settings partial. I need to store a boolean value that should be set and unset using a checkbox.

While

<input  type="text" id="settings_mytext"
            value="<%= settings['mytext'] %>"
            name="settings[mytext]"
>

works for string and numeric values, the following does not work for boolean values or any values at all.

<input  type="checkbox" id="settings_myboolean"
            checked="<%= settings['myboolean'] %>"
            value="<%= settings['myboolean'] %>"
            name="settings[myboolean]"
>

So does anyone know how to store the checked state of a checkbox using the Redmine provided plugin settings page?

Thanks for your help.

  • try this way https://github.com/twinslash/redmine_omniauth_google/blob/master/app/views/settings/_google_settings.html.erb#L15 – gotva Feb 03 '15 at 11:05

1 Answers1

0

Try this way:

<p>
  <label>Oauth authentification:</label>
  <%= check_box_tag "settings[oauth_authentification]", true, @settings[:oauth_authentification] %>
</p>
gotva
  • 5,919
  • 2
  • 25
  • 35