Creating a table in moodleform class

Creating a table in moodleform class

- L Passaglia の投稿
返信数: 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

L Passaglia への返信

Re: Creating a table in moodleform class

- Tim Hunt の投稿
画像 Core developers 画像 Documentation writers 画像 Particularly helpful Moodlers 画像 Peer reviewers 画像 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.

Tim Hunt への返信

Re: Creating a table in moodleform class

- 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!!