Creating a table in moodleform class

Creating a table in moodleform class

by L Passaglia -
Number of replies: 2

Hi,

How can one create a table in a moodleform class. I would like to create a table with columns and a variable number of rows. The first column contains text, the second column contains 5 radio buttons and the third column contains a text input field. Is that possible? Can anyone help?

Thank you

Average of ratings: -
In reply to L Passaglia

Re: Creating a table in moodleform class

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This is not a good use for a table, but you can get close to this effect. You need to use the 'group' element type. That lets you put several form fields next to each other in a row.

Then you can use CSS get the layout you want.

Just be warned that the CSS to make Moodle forms 'responsive' can make that hard to achieve.

There are examples of this sort of thing in some of the Question type forms, and the Quiz settings form.

In reply to Tim Hunt

Re: Creating a table in moodleform class

by L Passaglia -

Hello Tim!

... and responsiveness is something that I do require for this module.

I was working with the group element approach, but so far I just don't like the results. Programming not being my primary specialty, I'm not very knowledgeable with CSS, and so far have been able to avoid it. But if necessary I will look into it and try your suggestion.

Thank you very much for your reply!!