If you are talking about using SQLFORM with a DAL table, when you define 
Field objects, you can specify a custom widget via the "widget" argument -- 
it must be a callable object that takes a Field object and a value. For 
more details, see 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Widgets.

Also, you can create any custom HTML tag using the TAG helper:

TAG['ons-input'](_type='text', _value='hello')

produces:

<onui-input type="text" value="hello"></onui-input>

Note, if you simply use the TAG helper to generate markup, you won't get 
the validation behavior of the standard INPUT helper. As an alternative, 
you can create a custom tag based on the INPUT helper:

class OnsInput(INPUT):
    tag = 'ons-input'

You could then do:

OnsInput(_type='text', _value='hello', requires=db.myfield.requires)

The above will produce the same HTML markup, but the resulting Python 
object will also be able to validate its input. You could do the same for 
the SELECT helper.

Based on the above, you could create custom widgets -- see the various 
widget classes in gluon.sqlhtml. Once you've got some custom widgets, you 
could then monkey patch SQLFORM.widgets by overwriting some or all of its 
items with your custom classes -- then your custom widgets will be the 
defaults used by SQLFORM.

Anthony

On Friday, September 15, 2017 at 10:46:38 PM UTC-4, Bernardo Leon wrote:
>
> I have been researching about UI Frameworks and stumbled upon Onsen UI 
> <https://onsen.io/>. It seems easy and provides good results but to use 
> this UI Framework I need to use their components which are html tags.
>
> If I have a field that is rendered as an html input how can I customize 
> its widget so I can use <ons-input> instead of <input> and so on? Thank you!
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to