BlackHatSamurai
BlackHatSamurai

Reputation: 23513

Update form based on dropdown selection

I'm new to Rails and I'm trying to figure out how to change either the fields in the form, or the form itself, based on the selection of a drop down menu. I have thought about using AJAX, or about embedded Ruby within the form. Any direction would be great.

Upvotes: 0

Views: 244

Answers (1)

Raindal
Raindal

Reputation: 3237

Well, obviously there will be javascripts involved at some point.

I think there are 2 solutions for you to choose from:

  1. using ajax to fetch the new data to change your form upon dropdown changes
  2. loading everything you need from the first time (when landing to the page) and then displayhing/hiding things only using javascript

Starting from this, I suppose your decision will be made depending if you want/can afford loading everything you need from the beginning... and if not you'll probably go with ajax.

Let us know if you need some more details. : )

Upvotes: 1

Related Questions