Thank you both. So let's assume that I designed the dynamic form using only 
jQuery and HTML and I have a submit button that POSTs the form to a 
controller. How do I process that on the controller, since the form was not 
created with web2py tools (FORM, SQLFORM etc)?

On Friday, June 10, 2016 at 3:55:58 AM UTC+3, Anthony wrote:
>
> The books and movies could be done easily via list:string fields. However, 
> for the cars and bikes, you would need linked tables with child records 
> because you need to store both the model and an uploaded image for each.
>
> Anthony
>
> On Thursday, June 9, 2016 at 5:26:32 PM UTC-4, desta wrote:
>>
>> Something like this:
>>
>> ====================================================================
>> * ## Personal Details ##
>> * Name:    _________________
>> * Surname: _________________
>> * 
>> * Mobile phone: _________
>> * 
>> * ## Book part ##
>> * Book title: _____________________
>> * 
>> *                  <Add another book>
>> * 
>> * 
>> * Do you like movies? Yes/No
>> * (if yes then show the ##movie part##, else skip)
>> * 
>> * ## Movie part ##
>> * Movie title: ____________________
>> * 
>> *                  <Add another movie>
>> * 
>> * Do you prefer cars or bikes?
>> * (if car then show ## cars parts ## else show ## bikes part ##)
>> * 
>> * ## Car part ##
>> * Car model: __________________
>> * Upload image: <browse>
>> *                   <Add another image>
>> * 
>> *                   <Add another car>
>> * 
>> * ## Bike part ##
>> * Bike model: __________________
>> * Upload image: <browse>
>> *                   <Add another image>
>> * 
>> *                   <Add another bike>
>> ====================================================================
>>
>> Thanks.
>>
>> On Thursday, June 9, 2016 at 11:47:03 PM UTC+3, Dave S wrote:
>>>
>>>
>>>
>>> On Thursday, June 9, 2016 at 1:42:29 PM UTC-7, desta wrote:
>>>>
>>>> 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).
>>>>
>>>>
>>> You may want to give us a more detailed example, but using a temporary 
>>> table to hold things is certainly one possible solution.
>>>
>>> /dps
>>>
>>>  
>>>
>>>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to