One more thing.

using form.append() the new item will be appended at the end of the form.

if you want this item to be inserted ina  desired position:

a.insert(1,INPUT(_name='itemname'))

when '1' is the position on index starting at 0, in every form created by
SQLFORM the item 0 is <table>, and you can reffer to this table as:

form[0].insert() or form[0].append

look this example:

>>> a = SQLFORM(db.category)
>>> a[0]
<gluon.html.TABLE object at 0x101f839d0>
>>> a[0].insert(1,INPUT(_name='bruno'))
>>> print a
<form action="" enctype="multipart/form-data" method="post"><table><tr
id="category_name__row"><td class="w2p_fl"><label for="category_name"
id="category_name__label">Name: </label></td><td class="w2p_fw"><input
class="string" id="category_name" name="name" type="text" value=""
/></td><td class="w2p_fc"></td></tr><tr><td>*<input name="bruno" type="text"
/>*</td></tr><tr id="submit_record__row"><td class="w2p_fl"></td><td
class="w2p_fw"><input type="submit" value="Submit" /></td><td
class="w2p_fc"></td></tr></table></form>

2010/12/13 Bruno Rocha <rochacbr...@gmail.com>

> form = SQLFORM(db.table)
> myinput = INPUT(_type='text',_name='testing',_value='blablabla')
> form.append(myinput)
>
> Example in shell:
>
> >>> a = SQLFORM(db.category)
> >>> a
> <gluon.sqlhtml.SQLFORM object at 0x101c42d50>
> >>> print a
> <form action="" enctype="multipart/form-data" method="post"><table><tr
> id="category_name__row"><td class="w2p_fl"><label for="category_name"
> id="category_name__label">Name: </label></td><td class="w2p_fw"><input
> class="string" id="category_name" name="name" type="text" value=""
> /></td><td class="w2p_fc"></td></tr><tr id="submit_record__row"><td
> class="w2p_fl"></td><td class="w2p_fw"><input type="submit" value="Submit"
> /></td><td class="w2p_fc"></td></tr></table></form>
> >>> a.append(INPUT(_type='text',_name='testing'))
> >>> a
> <gluon.sqlhtml.SQLFORM object at 0x101c42d50>
> >>> print a
> <form action="" enctype="multipart/form-data" method="post"><table><tr
> id="category_name__row"><td class="w2p_fl"><label for="category_name"
> id="category_name__label">Name: </label></td><td class="w2p_fw"><input
> class="string" id="category_name" name="name" type="text" value=""
> /></td><td class="w2p_fc"></td></tr><tr id="submit_record__row"><td
> class="w2p_fl"></td><td class="w2p_fw"><input type="submit" value="Submit"
> /></td><td class="w2p_fc"></td></tr></table><input name="testing"
> type="text" /></form>
> >>>
>
>
> 2010/12/13 Carlos <carlosgali...@gmail.com>
>
> Hi weheh,
>>
>> Yes, I've looked at virtual and computed fields, but I believe (not
>> sure) they do not provide the behavior I require.
>>
>> I need a non-persistent field/widget (e.g. checkboxes) in a regular
>> persistent SQLFORM, such that the flow after the submit will depend on
>> these non-persistent values. For reference having one checkbox in the
>> SQLFORM that says "I want to proceed to X step after submit".
>>
>> I'm not sure if I'm explaining well?.
>>
>> Thanks,
>>
>>   Carlos
>>
>>
>> On Dec 12, 9:33 pm, weheh <richard_gor...@verizon.net> wrote:
>> > Have you looked at virtual fields and computed fields?
>> >
>> > On Dec 12, 6:54 pm, Carlos <carlosgali...@gmail.com> wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > Hi,
>> >
>> > > Is it possible to define extra non-persistent fields in forms, either
>> > > by CRUD or SQLFORM?.
>> >
>> > > Or is SQLFORM.factory the only option?.
>> >
>> > > Thanks,
>> >
>> > >    Carlos
>>
>
>
>
> --
>
> Bruno Rocha
> http://about.me/rochacbruno/bio
>



-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to