Well, I am really not sure how to implement this on database-side either, 
so any feedback from you, more experienced people, would be very 
insightful. 

Here is an example form of what I mean:

A form that a user can enter books they like. So there is a title field 
that accepts the name of the book. Also there is a button 'Add more books' 
that will create an additional text field for the user to enter an 
additional book title. The amount of books a user can add is unconstrained, 
therefore, one user may add only 1 book and other user can add 100 books.

I don't see how it is possible to store such information in a table in a 
conventional way. One way I am thinking to implement this, is to create a 
JSON string that contains all the information of the form and just enter 
that into the table. What do you think about this method?

Thanks again.

On Thursday, June 9, 2016 at 10:23:58 PM UTC+3, Dave S wrote:
>
>
>
> On Thursday, June 9, 2016 at 11:47:43 AM UTC-7, desta wrote:
>>
>> Hello everyone,
>>
>> My current task is to create a form where fields can be added/removed. Is 
>> it possible to handle such forms with web2py?
>>
>> Thanks.
>>
>
> I am not sure I understand what you want to do.
>
> Is it
>
> a) have a database table that doesn't change its layout, but you want to 
> present different sets of columns at different times?
> b) have a database table that doesn't change its layout, but you want to 
> hide or unhide columns as the user views the data?
> c) something else?
>
> a) is not difficult, if you use the SQLFORM and its relatives ... there 
> are settings for hiding fields.
> b) is a little more difficult; you may have to choose to reload the page, 
> use ajax requests to reload the form, or use javascript to hide columns 
> yourself.
>
> <URL:http://web2py.com/books/default/chapter/29/07/forms-and-validators>
>
> Good luck!
>
> /dps
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to