Changing Form Style for the auth forms

91 views
Skip to first unread message

Paul Gerrard

unread,
Aug 21, 2024, 1:39:41 PM8/21/24
to py4web
Is there an easy way of using, for example FormStyleBulma, for the auth form for registration, logging in etc.? 

Can't find anything in the docus. I'm using Bulma styles everywhere - but the auth forms don't - by default./

Thanks, as always,
Paul.

Jim Steil

unread,
Aug 21, 2024, 4:48:01 PM8/21/24
to py4web
I created this a while ago


I have not updated to the latest py4web releases, but I think it handles the auth pages using bulma

Gotta run right now but reply back if you need more help

-Jim

Paul Gerrard

unread,
Aug 22, 2024, 11:35:20 AM8/22/24
to py4web
Thanks - I see what you've done. Gets me mostly there - but the links to e.g. 'register' next to the log in button aren't styled. I'll look closer at the structure of  the form object. I wonder can I change classes inside a form object?

Paul.

Paul Gerrard

unread,
Aug 22, 2024, 12:04:24 PM8/22/24
to py4web
Got a solution to fix the labels (want left justified rather than centered) and text links (prefer buttons). I found a big hint in the manual here: https://py4web.com/_documentation/static/en/chapter-12.html#custom-widgets 

This content from the auth.html file in the templates directory. I don'tknow if this is a good/elegant solution - but it seems to work

[[extend "layout.html"]]
<style>
.auth-container {
max-width: 80%;
min-width: 400px;
margin-left: auto;
margin-right: auto;
border: 1px solid #e1e1e1;
border-radius: 10px;
padding: 20px;
}
</style>
<div class="auth-container">
[[
fields = form.structure.find('[class=white]')
for f in fields:
f['_class'] = 'button is-link'
pass

fields = form.structure.find('label')
for f in fields:
f['_class'] = 'label has-text-left'
pass
]]
[[=form]]
</div>


Krzysztof Socha

unread,
Aug 23, 2024, 4:21:29 AM8/23/24
to Paul Gerrard, py4web
There is a parameter actually to use:

auth.param.formstyle = FormStyleBulma

Works great for me. 

Cheers,
Krzysztof. 


--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/0bb889f4-bf74-4612-9598-9cbc75e8af88n%40googlegroups.com.

Paul Gerrard

unread,
Aug 26, 2024, 8:45:47 AM8/26/24
to py4web
Thanks. I got that idea already from Jim's code above - and it works pretty well. But I had to use the hack above to alter the links on the form.

Thanks again :O)

Reply all
Reply to author
Forward
0 new messages