Dynamic show form fields depending on dropdown box

I have one question, let me take an example. when a user visits:


it will show a form that has forum, name, email, subject, text five
fields for posting. right?

I want to provide more features on this form page, when the user choose
a different forum from the first drop list, the form will show more
different fields, such as a time selecor, or an option or what ever I
want to show to my users.

how can I do use ruby/rails or javascript? thanks in advance.