Nice, and this way insert_url is anything that you want it to be?

-Thadeus





On Sun, Apr 11, 2010 at 12:35 PM, Rafael Pinheiro
<[email protected]> wrote:
> For some time i am missing a small feature on web2py, the IS_IN_DB validator
> forces the widget to be a OptionWidget populated from the database, but if i
> need to add a new record to the table that populates it i have to open a new
> tab on my browser, add the new record and realod the form to get the new
> record.
>
> I saw somewhere(i think it was on django admin) an option to add a new
> record next to the option widget.
>
> I did a quick hack on the web2py code to add a link that opens a new tab or
> window with a url that i specify when i use the IS_IN_DB validator. I am not
> familiar with the web2py core code, so it probably could be done in a better
> way, maybe it should be a SQLFORM instead of a url and open on a jquery
> dialog.
>
> Here goes the code and a screenshot so you all can understand better:
>
> Screenshot: http://img526.imageshack.us/img526/9454/screenshot001zu.png
> OptionsWidget: http://pastebin.com/sw4DfWh5
> IS_IN_DB: http://pastebin.com/75ZHHtxz
>
> Basically i added a new parameter named insert_url on the validator and
> added the "New" link on the validator if IS_IN_DB is on the requires list
> and insert_url is set.
>
> --
> ►Rafael Pinheiro
> ►Email: [email protected]
> ►Email: [email protected]
> ►MSN: [email protected]
> ►Blog: http://rbpinheiro.wordpress.com/
>
>


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to