Indeed. While I was waiting for replies I realized my question (and
thinking) was somewhat flawed. What I want to achieve is an SQLFORM.factory
of two tables, t1 and t2, where t2 is placed after t1.this_field instead of
after t1.last_field, visually (all <tr>s)
t1.field
...
t1.this_field
t2.field
...
t2.last_field
t1.field
...
t1.last_field
submit_record
then I want the user to be able to change to a different t2 (ajax load) by
selecting an appropriate value of t1.this_field.
I think it would be simple to output the default combined form - with the
whole of t2 following the whole of t1 - and then move t2's rows in place
with jQuery, but I got deep into this experiment of doing all the form
manipulation using server-side DOM. Maybe I should back out and just do it
with jQuery, though it's less visually appealing.
On Saturday, August 17, 2013 2:52:27 PM UTC+2, Niphlod wrote:
>
> there's a conceptual problem with your question.... either you want to
> save a list of HTML helpers or you need to save a full-blown form. Of
> course you serializing only the HTML part of the form won't get you
> form.vars, form.accepts(), etc etc.
> I'm curious though, what and why do you need it?
>
> On Saturday, August 17, 2013 2:33:09 PM UTC+2, step wrote:
>>
>> And in fact it isn't a true copy because after the mapping the so called
>> trs_true_copy has lost all the SQLFORM specific data, like links to
>> form.vars, etc. So I don't know of a way to make a true copy, and I'm
>> asking for one. Thanks.
>>
>> On Saturday, August 17, 2013 2:19:39 PM UTC+2, step wrote:
>>
>>> I discovered one way to make a true copy of some list of HTML helpers. I
>>> would like to know if there are other more, web2py / pythonic ways to do
>>> it. So for instance:
>>>
>>> form = SQLFORM.factory()
>>> trs = form.elements('<tr>')
>>> trs_true_copy = map(lambda x: TAG(x.xml()),trs)
>>>
>>> which works just fine, though it seems a bit overkill having to
>>> serialize and deserialize to make a true copy.
>>> TIA
>>>
>>>
--
---
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/groups/opt_out.