The book part that I mentioned is a part of much larger form, that has more 
dynamic elements. So I was thinking it was a good idea to store the whole 
form into a single table to keep things manageable. If I understand 
correctly you suggest to break up the form on db-side, and create a table 
for each dynamic part of the form (similar to the books example).

On Thursday, June 9, 2016 at 11:35:28 PM UTC+3, Dave S wrote:
>
>
>
> On Thursday, June 9, 2016 at 1:19:35 PM UTC-7, desta wrote:
>>
>> 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.
>>
>
>
> An additional book would be in additional row in a table.
>
> ---------------------------------------------------------
> |author      |   title                                  |
> ---------------------------------------------------------
> | Henry X    | The Importance of Y                      |
> ---------------------------------------------------------
> | Dorothy D  | Information Warfare and Security         |
> ---------------------------------------------------------
> | Peter D    | An Exploration of Writing                |
> ---------------------------------------------------------
> | Phoebe S   | Birding on Borrowed Time                 |
> ---------------------------------------------------------
>            | add more  |
>            -------------
>
>
>>
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to