[web2py] Re: subforms / formsets / form cloning imprementation

2013-01-08 Thread Derek
Take a look at this - maybe it's similar to what you need...

http://www.web2pyslices.com/slice/show/1432/insert-and-delete-ajax-show-process

On Monday, January 7, 2013 12:02:01 AM UTC-7, Henrique Pantarotto wrote:
>
> Hello everybody!
>
> I'm quite new to Python and web2py, but I "consumed" all of web2py's 
> wonderful documentation at the last few days and I'm quite amazed at this 
> wonderful framework. But there's a feature that I need that I couldn't find 
> a way to easily implement it.
>
> The application that I'm developing requires extensive use of form cloning 
> within a single web page, done dynamically at the client side.  I'm not 
> really sure how to call this "technique", so I found a bit hard to find 
> information regarding this at this mailing list's archive.
>
> What I want to accomplish can be easily understood viewing the screenshots 
> from this tool: http://www.mdelrosso.com/sheepit/
>
> I already have my own (ugly) jquery code to create the forms dynamically, 
> and of course I could validate it manually on web2py's side, but I was 
> looking into an easier implementation using something like FORM or SQLFORM. 
> Like I said, I'm very new to web2py and python, and I have no idea how 
> django works, but I think I need to accomplish something similar to this: 
> https://docs.djangoproject.com/en/dev/topics/forms/formsets/
>
> I tried searching this mailing list archive and I found a couple of 
> discussions from people trying to do the same thing, but I didn't find a 
> solution.
>
> https://groups.google.com/forum/#!topic/web2py/ssaSj6v9Wu8/discussion
> https://groups.google.com/d/topic/web2py/UK8NZ1VMlNk/discussion
>
> But these are threads from 2011
>
> There's also this guy asking something similar a couple of months ago: 
> https://groups.google.com/d/topic/web2py/IPMz4FylT2k/discussion and 
> http://stackoverflow.com/questions/13215902/web2py-possible-to-submit-multiple-forms-with-a-single-submit-button/13215926#13215926but
>  the solution presented didn't seem very elegant.
>
> Anyway, I would really appreciate any help on this.
>
>
> Thanks, Henrique.
>
>

-- 





[web2py] Re: subforms / formsets / form cloning imprementation

2013-01-08 Thread Derek
Perhaps it would be a nice feature to add to the smartgrid - in place ajax 
update / addition.
So you'd just add a smartgrid to your form, and you can click 'add' and 
right in place you can add a new record to the grid / db.


On Tuesday, January 8, 2013 11:43:31 AM UTC-7, Henrique Pantarotto wrote:
>
> Hi Christian, thanks for your reply!  Your approach sounds interesting and 
> it seems to be one of the best options with what's possible as for this 
> moment.
>
> I have this page already implemented and working in php/javascript, but 
> I'm searching for a new "full featured framework" exactly to avoid these 
> kinds of ugly workarounds. I guess I'll either wait until web2py implements 
> this, or I guess I'll have to decide between rails or django for this 
> project. I'm not a python or ruby programmer (I program mostly in 
> C/Perl/shell and php), so it doesn't really matter much to me.
>
> I read all of web2py's documentation and created a few demo projects and I 
> enjoyed it very much. I wish I had the programming experience and knowledge 
> to help web2py developers to implement this feature, as it seems lots of 
> other people also need this (I've found MANY threads from people asking the 
> same thing on this mailing list).
>
> Thanks again!
>
> On Tuesday, January 8, 2013 2:17:05 AM UTC-2, howesc wrote:
>>
>> i have an (untested) idea...plugging together a few things i have used 
>> before
>>
>>  - you could create templates of field sets using handlebars: 
>> http://handlebarsjs.com/  then you can via JS add them to the page based 
>> on user interaction.
>>  - you can use hidden fields to provide some meta data on the form.
>>  - remembering that in your controller you define your SQLFORM *before* 
>> you process it, you could check for the presence of your hidden fields in 
>> request.vars, and based on their values initialize your SQLFORM to match 
>> the sub-forms that were added to the form.  then when you call .process it 
>> will check all those fields as well.
>>
>> i don't know if that is a great idea or not (we recently solved this 
>> problem at my workplace but i think ended up using handlebars and manual 
>> form processing)it's a thought we considered and still might try!
>>
>> christian
>>
>> On Sunday, January 6, 2013 11:02:01 PM UTC-8, Henrique Pantarotto wrote:
>>>
>>> Hello everybody!
>>>
>>> I'm quite new to Python and web2py, but I "consumed" all of web2py's 
>>> wonderful documentation at the last few days and I'm quite amazed at this 
>>> wonderful framework. But there's a feature that I need that I couldn't find 
>>> a way to easily implement it.
>>>
>>> The application that I'm developing requires extensive use of form 
>>> cloning within a single web page, done dynamically at the client side.  I'm 
>>> not really sure how to call this "technique", so I found a bit hard to find 
>>> information regarding this at this mailing list's archive.
>>>
>>> What I want to accomplish can be easily understood viewing the 
>>> screenshots from this tool: http://www.mdelrosso.com/sheepit/
>>>
>>> I already have my own (ugly) jquery code to create the forms 
>>> dynamically, and of course I could validate it manually on web2py's side, 
>>> but I was looking into an easier implementation using something like FORM 
>>> or SQLFORM. Like I said, I'm very new to web2py and python, and I have no 
>>> idea how django works, but I think I need to accomplish something similar 
>>> to this: https://docs.djangoproject.com/en/dev/topics/forms/formsets/
>>>
>>> I tried searching this mailing list archive and I found a couple of 
>>> discussions from people trying to do the same thing, but I didn't find a 
>>> solution.
>>>
>>> https://groups.google.com/forum/#!topic/web2py/ssaSj6v9Wu8/discussion
>>> https://groups.google.com/d/topic/web2py/UK8NZ1VMlNk/discussion
>>>
>>> But these are threads from 2011
>>>
>>> There's also this guy asking something similar a couple of months ago: 
>>> https://groups.google.com/d/topic/web2py/IPMz4FylT2k/discussion and 
>>> http://stackoverflow.com/questions/13215902/web2py-possible-to-submit-multiple-forms-with-a-single-submit-button/13215926#13215926but
>>>  the solution presented didn't seem very elegant.
>>>
>>> Anyway, I would really appreciate any help on this.
>>>
>>>
>>> Thanks, Henrique.
>>>
>>>

-- 





[web2py] Re: subforms / formsets / form cloning imprementation

2013-01-08 Thread Henrique Pantarotto
Hi Christian, thanks for your reply!  Your approach sounds interesting and 
it seems to be one of the best options with what's possible as for this 
moment.

I have this page already implemented and working in php/javascript, but I'm 
searching for a new "full featured framework" exactly to avoid these kinds 
of ugly workarounds. I guess I'll either wait until web2py implements this, 
or I guess I'll have to decide between rails or django for this project. 
I'm not a python or ruby programmer (I program mostly in C/Perl/shell and 
php), so it doesn't really matter much to me.

I read all of web2py's documentation and created a few demo projects and I 
enjoyed it very much. I wish I had the programming experience and knowledge 
to help web2py developers to implement this feature, as it seems lots of 
other people also need this (I've found MANY threads from people asking the 
same thing on this mailing list).

Thanks again!

On Tuesday, January 8, 2013 2:17:05 AM UTC-2, howesc wrote:
>
> i have an (untested) idea...plugging together a few things i have used 
> before
>
>  - you could create templates of field sets using handlebars: 
> http://handlebarsjs.com/  then you can via JS add them to the page based 
> on user interaction.
>  - you can use hidden fields to provide some meta data on the form.
>  - remembering that in your controller you define your SQLFORM *before* 
> you process it, you could check for the presence of your hidden fields in 
> request.vars, and based on their values initialize your SQLFORM to match 
> the sub-forms that were added to the form.  then when you call .process it 
> will check all those fields as well.
>
> i don't know if that is a great idea or not (we recently solved this 
> problem at my workplace but i think ended up using handlebars and manual 
> form processing)it's a thought we considered and still might try!
>
> christian
>
> On Sunday, January 6, 2013 11:02:01 PM UTC-8, Henrique Pantarotto wrote:
>>
>> Hello everybody!
>>
>> I'm quite new to Python and web2py, but I "consumed" all of web2py's 
>> wonderful documentation at the last few days and I'm quite amazed at this 
>> wonderful framework. But there's a feature that I need that I couldn't find 
>> a way to easily implement it.
>>
>> The application that I'm developing requires extensive use of form 
>> cloning within a single web page, done dynamically at the client side.  I'm 
>> not really sure how to call this "technique", so I found a bit hard to find 
>> information regarding this at this mailing list's archive.
>>
>> What I want to accomplish can be easily understood viewing the 
>> screenshots from this tool: http://www.mdelrosso.com/sheepit/
>>
>> I already have my own (ugly) jquery code to create the forms dynamically, 
>> and of course I could validate it manually on web2py's side, but I was 
>> looking into an easier implementation using something like FORM or SQLFORM. 
>> Like I said, I'm very new to web2py and python, and I have no idea how 
>> django works, but I think I need to accomplish something similar to this: 
>> https://docs.djangoproject.com/en/dev/topics/forms/formsets/
>>
>> I tried searching this mailing list archive and I found a couple of 
>> discussions from people trying to do the same thing, but I didn't find a 
>> solution.
>>
>> https://groups.google.com/forum/#!topic/web2py/ssaSj6v9Wu8/discussion
>> https://groups.google.com/d/topic/web2py/UK8NZ1VMlNk/discussion
>>
>> But these are threads from 2011
>>
>> There's also this guy asking something similar a couple of months ago: 
>> https://groups.google.com/d/topic/web2py/IPMz4FylT2k/discussion and 
>> http://stackoverflow.com/questions/13215902/web2py-possible-to-submit-multiple-forms-with-a-single-submit-button/13215926#13215926but
>>  the solution presented didn't seem very elegant.
>>
>> Anyway, I would really appreciate any help on this.
>>
>>
>> Thanks, Henrique.
>>
>>

-- 





[web2py] Re: subforms / formsets / form cloning imprementation

2013-01-08 Thread Henrique Pantarotto
I've been researching about this since my last post, and just to be clear, 
this is exactly what I need to 
do: http://railscasts.com/episodes/196-nested-model-form-part-1 (please 
watch minute 1:00 of this video).

So I wonder if it is possible to use web2py to create nested forms such as 
django's formsets 
(https://docs.djangoproject.com/en/dev/topics/forms/formsets/) or Ruby on 
Rail's Active Record Nested Attributes 
(http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html)?


Thanks

On Monday, January 7, 2013 5:02:01 AM UTC-2, Henrique Pantarotto wrote:
>
> Hello everybody!
>
> I'm quite new to Python and web2py, but I "consumed" all of web2py's 
> wonderful documentation at the last few days and I'm quite amazed at this 
> wonderful framework. But there's a feature that I need that I couldn't find 
> a way to easily implement it.
>
> The application that I'm developing requires extensive use of form cloning 
> within a single web page, done dynamically at the client side.  I'm not 
> really sure how to call this "technique", so I found a bit hard to find 
> information regarding this at this mailing list's archive.
>
> What I want to accomplish can be easily understood viewing the screenshots 
> from this tool: http://www.mdelrosso.com/sheepit/
>
> I already have my own (ugly) jquery code to create the forms dynamically, 
> and of course I could validate it manually on web2py's side, but I was 
> looking into an easier implementation using something like FORM or SQLFORM. 
> Like I said, I'm very new to web2py and python, and I have no idea how 
> django works, but I think I need to accomplish something similar to this: 
> https://docs.djangoproject.com/en/dev/topics/forms/formsets/
>
> I tried searching this mailing list archive and I found a couple of 
> discussions from people trying to do the same thing, but I didn't find a 
> solution.
>
> https://groups.google.com/forum/#!topic/web2py/ssaSj6v9Wu8/discussion
> https://groups.google.com/d/topic/web2py/UK8NZ1VMlNk/discussion
>
> But these are threads from 2011
>
> There's also this guy asking something similar a couple of months ago: 
> https://groups.google.com/d/topic/web2py/IPMz4FylT2k/discussion and 
> http://stackoverflow.com/questions/13215902/web2py-possible-to-submit-multiple-forms-with-a-single-submit-button/13215926#13215926but
>  the solution presented didn't seem very elegant.
>
> Anyway, I would really appreciate any help on this.
>
>
> Thanks, Henrique.
>
>

-- 





[web2py] Re: subforms / formsets / form cloning imprementation

2013-01-07 Thread howesc
i have an (untested) idea...plugging together a few things i have used 
before

 - you could create templates of field sets using handlebars: 
http://handlebarsjs.com/  then you can via JS add them to the page based on 
user interaction.
 - you can use hidden fields to provide some meta data on the form.
 - remembering that in your controller you define your SQLFORM *before* you 
process it, you could check for the presence of your hidden fields in 
request.vars, and based on their values initialize your SQLFORM to match 
the sub-forms that were added to the form.  then when you call .process it 
will check all those fields as well.

i don't know if that is a great idea or not (we recently solved this 
problem at my workplace but i think ended up using handlebars and manual 
form processing)it's a thought we considered and still might try!

christian

On Sunday, January 6, 2013 11:02:01 PM UTC-8, Henrique Pantarotto wrote:
>
> Hello everybody!
>
> I'm quite new to Python and web2py, but I "consumed" all of web2py's 
> wonderful documentation at the last few days and I'm quite amazed at this 
> wonderful framework. But there's a feature that I need that I couldn't find 
> a way to easily implement it.
>
> The application that I'm developing requires extensive use of form cloning 
> within a single web page, done dynamically at the client side.  I'm not 
> really sure how to call this "technique", so I found a bit hard to find 
> information regarding this at this mailing list's archive.
>
> What I want to accomplish can be easily understood viewing the screenshots 
> from this tool: http://www.mdelrosso.com/sheepit/
>
> I already have my own (ugly) jquery code to create the forms dynamically, 
> and of course I could validate it manually on web2py's side, but I was 
> looking into an easier implementation using something like FORM or SQLFORM. 
> Like I said, I'm very new to web2py and python, and I have no idea how 
> django works, but I think I need to accomplish something similar to this: 
> https://docs.djangoproject.com/en/dev/topics/forms/formsets/
>
> I tried searching this mailing list archive and I found a couple of 
> discussions from people trying to do the same thing, but I didn't find a 
> solution.
>
> https://groups.google.com/forum/#!topic/web2py/ssaSj6v9Wu8/discussion
> https://groups.google.com/d/topic/web2py/UK8NZ1VMlNk/discussion
>
> But these are threads from 2011
>
> There's also this guy asking something similar a couple of months ago: 
> https://groups.google.com/d/topic/web2py/IPMz4FylT2k/discussion and 
> http://stackoverflow.com/questions/13215902/web2py-possible-to-submit-multiple-forms-with-a-single-submit-button/13215926#13215926but
>  the solution presented didn't seem very elegant.
>
> Anyway, I would really appreciate any help on this.
>
>
> Thanks, Henrique.
>
>

--