change data of a table with the selection of radio buttons in moodle 2.9.3

change data of a table with the selection of radio buttons in moodle 2.9.3

vidyalekshmi va發表於
Number of replies: 1

Hi,

I have two radio buttons in a page. I need to populate a table in the same page,  with respect to the selection of these radio buttons. I am using moodle 2.9.3. Anyone please help me. I am new in moodle. So i havn't  a clear idea about how to implement it.

評比平均分數: -
In reply to vidyalekshmi va

Re: change data of a table with the selection of radio buttons in moodle 2.9.3

Mark Johnson發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

Are you looking to do this using Javascript (i.e. you select a radio button and the table changes on the page), or just with PHP (you select a radio button, submit the form, it reloads teh page with a different table)?

If you're just using PHP, you want to look at the formslib documentation on how to create and handle forms in Moodle.  You might also want to look at the methods for outputting tables, which you can do using Templates (recommended if you're on Moodle >= 2.9) or Output Components.

If you want to use Javascript as well, you'll need to know how to use jQuery to detect the radio button being selected, make an AJAX request to send the selected value to a PHP script, and display the new table.  You'll then need to create a Javascript module containing the Javascript, and a PHP script for it to call which either returns the data for the table, or the HTML for the table itself.