tashfeen.ekram
2009-Jun-04 19:12 UTC
Creating a dynamic form and referring to a page with dynamic parameters
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 Law
2009-Jun-04 20:48 UTC
Re: Creating a dynamic form and referring to a page with dynamic parameters
2009/6/4 tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > 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 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
2009-Jun-04 20:53 UTC
Re: Creating a dynamic form and referring to a page with dynamic parameters
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. On Jun 4, 4:48 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/6/4 tashfeen.ekram <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > 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 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
Colin Law
2009-Jun-04 21:05 UTC
Re: Creating a dynamic form and referring to a page with dynamic parameters
2009/6/4 tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > 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
2009-Jun-04 23:37 UTC
Re: Creating a dynamic form and referring to a page with dynamic parameters
yes, that is correct. i would like to be able to stroe the info in the url On Jun 4, 5:05 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/6/4 tashfeen.ekram <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > 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
Colin Law
2009-Jun-05 20:31 UTC
Re: Creating a dynamic form and referring to a page with dynamic parameters
2009/6/5 tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > yes, that is correct. i would like to be able to stroe the info in the > urlI 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> > On Jun 4, 5:05 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> 2009/6/4 tashfeen.ekram <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> >> >> >> > 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 > > >