# Dynamic fields in forms

**URL:** <https://www.ruby-forum.com/t/dynamic-fields-in-forms/120501>\
**Category:** Rails\
**Created:** [November 17, 2007, 5:06pm UTC](https://www.ruby-forum.com/t/dynamic-fields-in-forms/120501 "2007-11-17T17:06:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexmic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/977dab/32.png) [@alexmic](https://www.ruby-forum.com/u/alexmic)\
**Post date:** [November 17, 2007, 5:06pm UTC](https://www.ruby-forum.com/t/dynamic-fields-in-forms/120501/1 "2007-11-17T17:06:49Z")

</div>

Hi all.

I am developing a rails app, more or less a car database.

The interresting part of the model is this :  
Country (has\_many) \<-\> (belongs\_to) Car maker (has\_many) \<-\>  
(belongs\_to) model etc. But some categories are off this dependency  
relationship, as for instance, Vintage, motors,…

The problem I am facing is making a new.rhtml file. More precisely, this  
kind of apps needs whether:

1. not to show the model until the country and the car maker have been  
selected
2. (optional) the upper categories are automatically set when a sub  
category is selected. For example : US - Ford appear when Mustang is  
selected in the form.

I’ve got a couple of books on rails I work on, but non goes on this  
subject.

I imagine that Ajax will be part of the answer and yet nothing like this  
has resulted so far on gg.

Any help most welcome!

Alex Mic

---

<div class="post-metadata">

**Author:** ![alexmic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/977dab/32.png) [@alexmic](https://www.ruby-forum.com/u/alexmic)\
**Post date:** [November 17, 2007, 5:09pm UTC](https://www.ruby-forum.com/t/dynamic-fields-in-forms/120501/2 "2007-11-17T17:09:56Z")

</div>

Making myself clearer on the 1) up there :  
The fields can or cannot be shown until the upper categories are filled,  
but if shown they are blank or unselectable.
