Hi Francisco, happy to help you, as I've gone a 4 day intensive bootstrap 3 integration to web2py and learned a lot about customizing the views and forms. This might not be the best (or only) solution, but has worked well for me:
- Web2py form includes classes based on their type, which I recommend to keep, if you want any added web2py functionality. - You need to use custom form style (form.custom.begin) and then manipulate each widget separately (or all of them in a for loop) Here's my form code in a view (controller is not modified). In this form I have added "form-control" class of bootstrap 3 and kept the original class as well. For textarea you can do "form.custom.widget.textfield['_rows'] = 3" if you want to make a smaller textarea. <<< <form action="" enctype="multipart/form-data" method="post" role="form"> <div class="form-group"> {{form.custom.widget.campaign['_class'] = 'generic-widget form-control'}} {{form.custom.widget.topic['_class'] = 'string form-control'}} {{form.custom.widget.topic['_placeholder'] = 'Idea topic'}} {{form.custom.widget.description['_class'] = 'text form-control'}} {{form.custom.widget.description['_placeholder'] = 'Idea description'}} <div class="form-group"> <label for="exampleSelect">Select a campaign</label> {{=form.custom.widget.campaign}} </div> <div class="form-group"> <label for="exampleInputTopic">Input idea topic and description</label> {{=form.custom.widget.topic}} </div> <div class="form-group"> {{=form.custom.widget.description}} </div> <button type="submit" class="btn btn-primary">Submit your idea</button> </div> {{=form.custom.end}} <<<< Ykä On Friday, October 4, 2013 8:14:33 PM UTC+3, Francisco García wrote: > > Hello all, > > I am loading a form from a database table, with CRUD or SQLFORM (It is the > same for me). > This form contains text fields and textarea fields between others. > > Now, I need to change in the views the class of all textareas, from class > ="text" to class="myclass" > How can I do this from controllers or views? (I can't edit any css file). > > I am trying with form.custom.widget but I can't change it. > I'm not sure if it is something simple, or it is impossible to do this way. > > > Thank you in advance. > Regards, > Francisco > -- 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/groups/opt_out.