Py4web readonly Form

64 views
Skip to first unread message

John Bannister

unread,
Mar 6, 2020, 3:53:17 AM3/6/20
to web2py-users
Hi All,

I have been testing Py4web and have the following to produce basically a 'view record' option :-

def view_test():
    form=Form(db.auth_user, record=1, readonly=True, deletable=False, formstyle=FormStyleBulma)
    if form.accepted:
        redirect(URL('index'))
    return dict(form=form)

This will redirect if I remove the readonly=True from the form but basically form is just displayed (all fields are readonly) and you can hit the submit button as many times as you like and nothing will happen.

Any ideas??

BR
John

Massimo Di Pierro

unread,
Mar 21, 2020, 2:36:03 AM3/21/20
to web2py-users
You may be right but what is the meaning of submitting and accepting a readonly form? What is a use case?

John Bannister

unread,
Mar 21, 2020, 4:11:39 AM3/21/20
to web...@googlegroups.com

Hi Massimo,

 

My use case is really to give the user the option to view data stored in a table without the ability to change anything hence readonly. Once they have finished viewing the form (normally by hitting the submit button) they will be redirected to whatever.

 

Hope it makes sense

John

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/2089781a-8a2e-4b62-90d4-98a6183b375b%40googlegroups.com.

villas

unread,
Mar 21, 2020, 1:02:04 PM3/21/20
to web2py-users
Hi John
What you say doesn't make much sense because you can style and view data however you wish, including in a readonly form.  Similarly a button can redirect your users to wherever you wish.  You don't need the framework forms for that.  Just style your page how you wish.

To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages