Re: [web2py] Re: Bootstrap and custom forms and widgets
Thanks, set it to this and it's now working: .form-actions { background-color: #d9edf7; border-top: 0; padding: 0; } On Wed, Sep 5, 2012 at 3:58 AM, Anthony abasta...@gmail.com wrote: I don't think it's a bug. The submit button is in a div with class form-actions, and bootstrap.css defines the background color of that class as whiteSmoke. You can override that with your own CSS rule for the form-actions class. Anthony On Tuesday, September 4, 2012 1:18:13 PM UTC-4, Alec Taylor wrote: Thanks, in that case I think I've found a bug in that formstyle setting. Around my submit button it has drawn a white rectangle; I've been able to extract it into a test-case: http://jsfiddle.net/**AlecTaylor/7whPt/http://jsfiddle.net/AlecTaylor/7whPt/ On Tue, Sep 4, 2012 at 11:09 PM, Anthony abas...@gmail.com wrote: Also, you can now create your own formstyle function, which should take the form object and a list of field tuples (each field tuple includes the id, label, controls, and comment for the field) and return the DOM you want displayed in the form (i.e., the part that goes inside form/form). Internally, this is how all the formstyles now work (each has its own function). To see how they work, check out the code: http://code.google.com/**p/web2py/source/browse/gluon/**sqlhtml.py#651http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#651 . Anthony On Tuesday, September 4, 2012 7:49:45 AM UTC-4, Anthony wrote: For Crud, it's a setting: crud.settings.formstyle = 'bootstrap' Anthony On Tuesday, September 4, 2012 5:36:55 AM UTC-4, Alec Taylor wrote: Unfortunately that didn't work: type 'exceptions.TypeError' create() got an unexpected keyword argument 'formstyle' type 'exceptions.TypeError' update() got an unexpected keyword argument 'formstyle' On Tue, Sep 4, 2012 at 7:31 PM, Niphlod nip...@gmail.com wrote: should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/**foru m/#!topic/web2py/**0Uk5b34LUschttps://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_**tvserieshttp://github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller####3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**er** rors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is
[web2py] Re: Bootstrap and custom forms and widgets
the code is out there on github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt --
Re: [web2py] Re: Bootstrap and custom forms and widgets
Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod niph...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller###**#3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt -- --
Re: [web2py] Re: Bootstrap and custom forms and widgets
should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com javascript:wrote: the code is out there on github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller###**#3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt -- --
Re: [web2py] Re: Bootstrap and custom forms and widgets
Unfortunately that didn't work: type 'exceptions.TypeError' create() got an unexpected keyword argument 'formstyle'type 'exceptions.TypeError' update() got an unexpected keyword argument 'formstyle' On Tue, Sep 4, 2012 at 7:31 PM, Niphlod niph...@gmail.com wrote: should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/**forum/#!topic/web2py/* *0Uk5b34LUsc https://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_**tvserieshttp://github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller####3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**er**rors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt -- -- --
Re: [web2py] Re: Bootstrap and custom forms and widgets
For Crud, it's a setting: crud.settings.formstyle = 'bootstrap' Anthony On Tuesday, September 4, 2012 5:36:55 AM UTC-4, Alec Taylor wrote: Unfortunately that didn't work: type 'exceptions.TypeError' create() got an unexpected keyword argument 'formstyle' type 'exceptions.TypeError' update() got an unexpected keyword argument 'formstyle' On Tue, Sep 4, 2012 at 7:31 PM, Niphlod nip...@gmail.com javascript:wrote: should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/** forum/#!topic/web2py/**0Uk5b34LUschttps://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_**tvserieshttp://github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller####3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**er**rors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt -- -- --
Re: [web2py] Re: Bootstrap and custom forms and widgets
Also, you can now create your own formstyle function, which should take the form object and a list of field tuples (each field tuple includes the id, label, controls, and comment for the field) and return the DOM you want displayed in the form (i.e., the part that goes inside form/form). Internally, this is how all the formstyles now work (each has its own function). To see how they work, check out the code: http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#651. Anthony On Tuesday, September 4, 2012 7:49:45 AM UTC-4, Anthony wrote: For Crud, it's a setting: crud.settings.formstyle = 'bootstrap' Anthony On Tuesday, September 4, 2012 5:36:55 AM UTC-4, Alec Taylor wrote: Unfortunately that didn't work: type 'exceptions.TypeError' create() got an unexpected keyword argument 'formstyle' type 'exceptions.TypeError' update() got an unexpected keyword argument 'formstyle' On Tue, Sep 4, 2012 at 7:31 PM, Niphlod nip...@gmail.com wrote: should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/** forum/#!topic/web2py/**0Uk5b34LUschttps://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_**tvserieshttp://github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller####3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**er**rors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt -- -- --
Re: [web2py] Re: Bootstrap and custom forms and widgets
Thanks, in that case I think I've found a bug in that formstyle setting. Around my submit button it has drawn a white rectangle; I've been able to extract it into a test-case: http://jsfiddle.net/AlecTaylor/7whPt/ On Tue, Sep 4, 2012 at 11:09 PM, Anthony abasta...@gmail.com wrote: Also, you can now create your own formstyle function, which should take the form object and a list of field tuples (each field tuple includes the id, label, controls, and comment for the field) and return the DOM you want displayed in the form (i.e., the part that goes inside form/form). Internally, this is how all the formstyles now work (each has its own function). To see how they work, check out the code: http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#651. Anthony On Tuesday, September 4, 2012 7:49:45 AM UTC-4, Anthony wrote: For Crud, it's a setting: crud.settings.formstyle = 'bootstrap' Anthony On Tuesday, September 4, 2012 5:36:55 AM UTC-4, Alec Taylor wrote: Unfortunately that didn't work: type 'exceptions.TypeError' create() got an unexpected keyword argument 'formstyle' type 'exceptions.TypeError' update() got an unexpected keyword argument 'formstyle' On Tue, Sep 4, 2012 at 7:31 PM, Niphlod nip...@gmail.com wrote: should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/**foru** m/#!topic/web2py/**0Uk5b34LUschttps://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_**tvserie**shttp://github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller###**#3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt -- -- -- --
Re: [web2py] Re: Bootstrap and custom forms and widgets
I don't think it's a bug. The submit button is in a div with class form-actions, and bootstrap.css defines the background color of that class as whiteSmoke. You can override that with your own CSS rule for the form-actions class. Anthony On Tuesday, September 4, 2012 1:18:13 PM UTC-4, Alec Taylor wrote: Thanks, in that case I think I've found a bug in that formstyle setting. Around my submit button it has drawn a white rectangle; I've been able to extract it into a test-case: http://jsfiddle.net/AlecTaylor/7whPt/ On Tue, Sep 4, 2012 at 11:09 PM, Anthony abas...@gmail.com javascript:wrote: Also, you can now create your own formstyle function, which should take the form object and a list of field tuples (each field tuple includes the id, label, controls, and comment for the field) and return the DOM you want displayed in the form (i.e., the part that goes inside form/form). Internally, this is how all the formstyles now work (each has its own function). To see how they work, check out the code: http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#651. Anthony On Tuesday, September 4, 2012 7:49:45 AM UTC-4, Anthony wrote: For Crud, it's a setting: crud.settings.formstyle = 'bootstrap' Anthony On Tuesday, September 4, 2012 5:36:55 AM UTC-4, Alec Taylor wrote: Unfortunately that didn't work: type 'exceptions.TypeError' create() got an unexpected keyword argument 'formstyle' type 'exceptions.TypeError' update() got an unexpected keyword argument 'formstyle' On Tue, Sep 4, 2012 at 7:31 PM, Niphlod nip...@gmail.com wrote: should be formstyle='bootstrap', the same way you use formstyle=divs , ul, etc Il giorno martedì 4 settembre 2012 10:34:07 UTC+2, Alec Taylor ha scritto: Thanks, but I can't seem to find anything in the release about how to use bootstrap with forms: https://groups.google.com/**foru** m/#!topic/web2py/**0Uk5b34LUschttps://groups.google.com/forum/#!topic/web2py/0Uk5b34LUsc (Note that I'm using crud.create and crud.update) On Tue, Sep 4, 2012 at 5:45 PM, Niphlod nip...@gmail.com wrote: the code is out there on github.com/niphlod/w2p_**tvserie**shttp://github.com/niphlod/w2p_tvseries, but included in web2py 2.0.6 there is other code for bootstrap-compatible forms Il giorno martedì 4 settembre 2012 05:03:59 UTC+2, Alec Taylor ha scritto: Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller###**#3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.**errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter
[web2py] Re: Bootstrap and custom forms and widgets
Hi Niphlod, Now that web2py 2 has been released, could you release the code for your form manipulation? Thanks a heap, Alec taylor On Sunday, May 20, 2012 2:48:57 AM UTC+10, Niphlod wrote: me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt --
[web2py] Re: Bootstrap and custom forms and widgets
Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt
[web2py] Re: Bootstrap and custom forms and widgets
me too, but in a different way. I'm working on an app and waiting for web2py 2.0 to release it to the public. It contains a function able to serialize form in bootstrap styles (i.e. form-horizontal, form-vertical, form-inline) With some additional work maybe that could be included to provide more than the current 'table3cols', 'table2cols', 'divs', 'ul' styles of the forms. Right now it's called into the view, i.e.: {{=twitter_form(form, 'form-vertical')}} Il giorno sabato 19 maggio 2012 11:10:30 UTC+2, Pystar ha scritto: Hi matt, I have been working extensively with bootstrap with web2py and I can say the approach you are taking is the best way. This is my solution #controller3 form = SQLFORM(db.blahblah) if form.accepts(request, session, hideerrror=True): blahblah the hideerror=True is what does the magic. It prevents your forms from displaying the error messages in the default position which is below the form field. In your views, you can now display your error messages by doing span class=help-inline{{=form.errors[post]}}/span make sure you put the above in a conditional IF, ElSE block or else the errors will be displayed whether you have errors in your form or not On Sunday, May 13, 2012 4:35:52 AM UTC+1, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt
[web2py] Re: Bootstrap and custom forms and widgets
Brilliant thanks for that. Matt On Sunday, 13 May 2012 15:53:19 UTC+12, Anthony wrote: http://web2py.com/books/default/chapter/29/7#Hide-errors Anthony On Saturday, May 12, 2012 11:35:52 PM UTC-4, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt
[web2py] Re: Bootstrap and custom forms and widgets
http://web2py.com/books/default/chapter/29/7#Hide-errors Anthony On Saturday, May 12, 2012 11:35:52 PM UTC-4, Matt wrote: Hi Everybody, I'm using bootstrap for a project with web2py. I want to create forms that mirror the standard approach taken by the bootstrap framework. They wrap each control like so: div class=control-group error label class=control-label for=inputErrorInput with error/label div class=controls input type=text id=inputError span class=help-inlinePlease correct the error/span p class=help-blockA comment for the field goes here./p /div /div Since this is custom code I using form.custom and form.fields for output the HTML myself. One small problem I've run up against in that when I do the following: {{= form.custom.widget.full_name }} If there is a form _error_ the following is output: input class=invalidinput id=xyz_full_name name=full_name type=text value= *div class=error id=full_name__errorplease enter their full name/div* * * Is there anyway to suppress the div or change it so that it can become *span class=help-inlineplease enter their full name**/span* * * Instead? Any help or suggestion for this would be greatly appreciated. Thanks in advance, Matt