# Smart forms in Rails?

**URL:** <https://www.ruby-forum.com/t/smart-forms-in-rails/87894>\
**Category:** Rails\
**Created:** [March 6, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/smart-forms-in-rails/87894 "2007-03-06T17:42:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![d2kagw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@d2kagw](https://www.ruby-forum.com/u/d2kagw)\
**Post date:** [March 6, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/smart-forms-in-rails/87894/1 "2007-03-06T17:42:32Z")

</div>

I am working on a project that needs a “Smart Form” type of system.  
That is, we need to have a Form Template system that chooses what  
elements of the form are displayed based on how the user answers other  
elements of the form. Does that make sense? Can anyone point me in the  
right direction?

---

<div class="post-metadata">

**Author:** ![d2kagw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@d2kagw](https://www.ruby-forum.com/u/d2kagw)\
**Post date:** [March 6, 2007, 6:12pm UTC](https://www.ruby-forum.com/t/smart-forms-in-rails/87894/2 "2007-03-06T18:12:58Z")

</div>

On Tue, Mar 06, 2007 at 05:42:32PM +0100, Aaron W. wrote :

> That is, we need to have a Form Template system that chooses what  
> elements of the form are displayed based on how the user answers other  
> elements of the form.

You mean for instance, that if your customer has checked the box  
‘children’, a form for the names of the children appear?

I had the same work to do for my project.  
I have written my own helpers which simply render partials with rjs  
(page.replace, etc.), or calling :oncomplete for auto\_complete fields,  
etc.  
You can have a look to the krjs plugin  
([http://choonkeat.svnrepository.com/svn/rails-plugins/krjs/](http://choonkeat.svnrepository.com/svn/rails-plugins/krjs/)) which is  
pretty useful but a little bit difficult to customize (you might want  
rewrite all completly).

By the way, I’ve got trouble with tabulars and page.replace but the  
problem was  
solved on this mailing list a couple of weeks ago.

Have fun,

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’
