> > This is the corresponding JS one optimized for bootstrap 3: > > jform.widgets['text'] = function(field) { return > jform.tag('textarea',{'name':field.name > ,'class':'form-control'})(field.value); } >
Massimo that looks good, however in SQLFORM I can change the textwidget in a very specific way - I can change it for a single field on a single table on a single controller, changing widgets in jform like this wouldn't work because you would change the text widget for all jforms being rendered in that webpage. Maybe you want to change the widget for just that one form and leave the others unchanged. Sometimes, you do want to change your textwidgets application wide but sometimes you don't. So things get a little more complicated. There needs to be some way to define context for jform where you can customize just one single form. Basically JForm would need to have a dictionary of table or even form specific widgets where you could do something like. jform.widgets.forms[myformid]['text'] = function(field) { return jform.tag('textarea',{'name':field.name ,'class':'form-control'})(field.value); } jform.widgets.tables[tablename]['text'] = function(field) { return jform.tag('textarea',{'name':field.name ,'class':'form-control'})(field.value); } So things do start to get messy. This solution, of course, isn't ideal if you are building a single page app as this context you're creating doesn't get automatically cleaned every call like it happens on the server side with SQLFORM so then you start to get strange interactions and bugs. Hence we have to figure out a smarter way to do it where the context is really available for just that one form and it goes away with it. -- 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.