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="inputError">Input with >>> error</label> >>> <div class="controls"> >>> <input type="text" id="inputError"> >>> <span class="help-inline">Please correct the error</span> >>> <p class="help-block">A 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__error">please enter their full >>> name</div>* >>> * >>> * >>> Is there anyway to suppress the div or change it so that it can become >>> >>> *<span class="help-inline">please enter their full name**</span>* >>> * >>> * >>> Instead? >>> >>> Any help or suggestion for this would be greatly appreciated. >>> >>> Thanks in advance, >>> Matt >>> >>> --