# Creating a dynamic form and referring to a page with dynamic parameters

**URL:** <https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524>\
**Category:** Rails\
**Created:** [June 4, 2009, 9:13pm UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524 "2009-06-04T21:13:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tashfeen.ekram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3ab097/32.png) [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Post date:** [June 4, 2009, 9:13pm UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524/1 "2009-06-04T21:13:16Z")

</div>

I want to create a form where a visitor can dynamically add more  
fields to it. The visitor will input a list of stuff and can be  
anywere from 1 to over ten. The user will be inputting name of a  
medication and then dosing. Then, when the user submit the form i want  
to be able to refer the user to a page with all of the inputs  
entereted parameterized so that the user can just save the link. so,  
the referring page can have one item parameterized or multiple. Each  
item the user adds will contain three attributes like dose and how  
often they take it.

i hope that is clear…

thanks

---

<div class="post-metadata">

**Author:** ![tashfeen.ekram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3ab097/32.png) [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Post date:** [June 4, 2009, 10:49pm UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524/2 "2009-06-04T22:49:11Z")

</div>

2009/6/4 tashfeen.ekram [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 

I would suggest thinking about what data you want in the database  
first and what the relationships are. Possibly you need a user table,  
a medications table and a user\_medications table, with a habtm  
relationship between medications and users. The user\_medications  
table being the join table and also containing the dosage data.

Then the views you require are various slices through the data.

Does that help to get you started?

Colin

---

<div class="post-metadata">

**Author:** ![tashfeen.ekram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3ab097/32.png) [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Post date:** [June 4, 2009, 10:54pm UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524/3 "2009-06-04T22:54:28Z")

</div>

i wanted to allow this feature to be available to users who are not  
logged in.  
the form is to basically allow users to put in several drugs of  
interest with some other info and get back an analysis of informatino  
eneterd. i do not need to save it in my db for future reference. but  
perhaps the user wants to see the same analysis again and could just  
save the link.

---

<div class="post-metadata">

**Author:** ![tashfeen.ekram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3ab097/32.png) [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Post date:** [June 5, 2009, 1:37am UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524/4 "2009-06-05T01:37:56Z")

</div>

yes, that is correct. i would like to be able to stroe the info in the  
url

---

<div class="post-metadata">

**Author:** ![tashfeen.ekram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3ab097/32.png) [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Post date:** [June 5, 2009, 10:33pm UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524/5 "2009-06-05T22:33:02Z")

</div>

2009/6/5 tashfeen.ekram [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> yes, that is correct. i would like to be able to stroe the info in the  
> url

I don’t think that is the way I would do it, I would use the database.  
You could do without the user table but keep the other data. Purging  
old data from the db occasionally if necessary. I am not sure how to  
go about it using the url. I can see how to use the url to generate  
the pages but I do not see immediately how to use the user input to  
generate the url.

Colin

---

<div class="post-metadata">

**Author:** ![tashfeen.ekram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3ab097/32.png) [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Post date:** [June 4, 2009, 11:06pm UTC](https://www.ruby-forum.com/t/creating-a-dynamic-form-and-referring-to-a-page-with-dynamic-parameters/169524/6 "2009-06-04T23:06:15Z")

</div>

2009/6/4 tashfeen.ekram [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> i wanted to allow this feature to be available to users who are not  
> logged in.  
> the form is to basically allow users to put in several drugs of  
> interest with some other info and get back an analysis of informatino  
> eneterd. i do not need to save it in my db for future reference. but  
> perhaps the user wants to see the same analysis again and could just  
> save the link.

If you want the user to be able see the same analysis again then you  
must store the data somewhere. Or are you suggesting putting all the  
data on medications and dosage in the url as parameters?

Colin
