Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28194

it should be great whether developers could apply css styles to each mform element

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.1
    • Forms Library
    • MOODLE_21_STABLE

      Moodle mform can display about 7 kind of items.
      They are:
      1. radio buttons
      2. edit fields
      3. checkboxes
      4. select
      5. fileupload
      6. multiselect
      7. textarea

      For almost all of them it is possible to provide a custom style passing it as last parameter to the corresponding mform method.

      There are only 2 exceptions and half.

      I do not know how to give a style to a multiselect and textarea
      and furthermore
      for 'date_selector' once it is written
      $mform->addElement('date_selector', $fieldname, $label, $options, $class);
      the css class style is applied, correctly, to all three elements of the
      'date_selector' so if the style is just a margin-left: 1em; the 'date_selector' is correctly moved on the right BUT 'date_selector' elements are ALSO separated by 1em.

      As fas as I can see the class mform should be modified in order to allow the developer to apply a style to each single element or to the whole 'date_selector'.
      I am thinking to the last parameters of the addElement() as an associative array like array('[day]'=>'padding-left:1em;', '[month]'=>'color:red;', '[year]'=>'text-decoration:underline;')

      To provide a style to a whole group of elements it should be found a way to apply it to the outer <fieldset class="felement fgroup">

        1. tastyform.png
          tastyform.png
          25 kB
        2. tastyform.php
          1 kB
        3. tastyform.css
          0.9 kB

            moodle.com Moodle HQ
            daniss Daniele Cordella
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.