Checkboxes in Simple Module (Model) | Fuel Beta

edited October 2012 in News & Announcements
Hey, my checkboxes don't render properly in the new version. (it's not selected and not saving)
I want to transform a input[type="text"] to a checkbox by setting $fields['comments_allowed']['type'] = 'checkbox';
in my form_fields method.

What am I doing wrong or what do I have to do to achieve this?

Comments

  • edited 7:22AM
    Btw, I've tried to do this with enums and it works, but in this case I would prefer a solution for checkboxes...
  • edited 7:22AM
    Try adding the following to the top of your model:
    public $boolean_fields = array('comments_allowed');
    The issue has to do with boolean fields actually being tinyint fields. Specifying the above makes sure they are treated as boolean fields instead of an integer field.
  • edited 7:22AM
    Yes, it works now, thanks.
    I'm going to finish the first backend version of the gallery module tomorrow and then I'll look for some possible javascript sliders or other ui-elements.

    Is it possible to pass the content of a module view to a layout used by fuel pages?
    The goal is to keep the whole system as modular as possible and to have only one "template/design" file.
  • edited 7:22AM
    You could load the view as a variable of $body and pass it to the layout that would merge in that $body variable:
    $vars['body'] = $this->load->module_view('my_module', 'my_view', $vars, TRUE); $this->fuel->pages->render('my_uri', $vars);
    Does that make sense?
Sign In or Register to comment.