Forum: Ruby on Rails Creating a dynamic form and referring to a page with dynamic parameters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
tashfeen.ekram (Guest)
on 2009-06-04 23:13
(Received via mailing list)
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
Colin L. (Guest)
on 2009-06-05 00:49
(Received via mailing list)
2009/6/4 tashfeen.ekram <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
tashfeen.ekram (Guest)
on 2009-06-05 00:54
(Received via mailing list)
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.
Colin L. (Guest)
on 2009-06-05 01:06
(Received via mailing list)
2009/6/4 tashfeen.ekram <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
tashfeen.ekram (Guest)
on 2009-06-05 03:37
(Received via mailing list)
yes, that is correct. i would like to be able to stroe the info in the
url
Colin L. (Guest)
on 2009-06-06 00:33
(Received via mailing list)
2009/6/5 tashfeen.ekram <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
This topic is locked and can not be replied to.