hi iain,

 Thanks a lot, its get the stuff done.

regards

Antony

On 10/12/07, iain duncan <[EMAIL PROTECTED]> wrote:
>
>
> On Wed, 2007-10-10 at 13:19 +0530, Antony Joseph wrote:
> > hi iain,
> >
> > Thanks for the help, its working fine.
> >
> > I want to format errors
> > for example:
> > In Registration form i am validating the fields like not empty
> > using validator (decorator).
> > suppose the field is not valid ,it display error like please enter a
> > value.
> > next to the feild,
> > i want to display the error down to the fields
> > and i want to customize the errors,format the error.
> >
> > How can i do this?
> >
> > please help me............
>
> Hey Anthony, the tip someone gave me is to use the ipython shell to find
> out what's in there. You can grab the template for any widget by using
> the shell and getting say widgets.TableForm.template. You can also see
> all the attributes by doing
>
> dir( widgets.TableForm )
>
> Then take a look at how errors are normally displayed an make yourself a
> template that does it your way! BTW, the errors are stored in a
> dictionary where the name of the field is the key and the error message
> is the value. Another handy trick is to use your log facility to peek
> into things at run time, ie in your error handler controller :
>
> if 'tg_errors' in kwargs:
>   for k,v in kwargs['tg_errors'].iteritems():
>      log.info('error: %s - %s' % (k,v) )
>
> HTH
> Iain
>
>
>
>
> >
> >
> > Thanks
> >
> > Antony
> >
> >
> > On 10/7/07, iain duncan <[EMAIL PROTECTED]> wrote:
> >
> >         > I am fresh to tg-widgets  , i want my table in my desired
> >         format, how
> >         > can i apply the css and do the formats.
> >
> >         Hi Antony, you have three choices ( that I know of ). You can
> >         pass css
> >         attributes into the field widgets for id and class and style
> >         them, or
> >         you can use a custom template, or you can make your own widget
> >         class and
> >         include the custom template in it.
> >
> >         To pass in a custom attribute on the individual field widgets
> >         do:
> >         w = widgets.TextArea( attrs={'id':'foo'},
> >         css_classes=['red','middle'] )
> >
> >         which will produce:
> >         <textarea rows="7" cols="50" class="textarea red middle"
> >         name="widget"
> >         id="foo"></textarea>
> >
> >         or for the table and form itself:
> >         t = widgets.TableForm(table_attrs={'id':'foo',
> >         'class':'mytableclass'},
> >         form_attrs={'id':'spam', 'class':'myformclass'})
> >
> >         producing:
> >         <form class="myformclass" id="spam" name="form"
> >         method="post">
> >         <table cellpadding="2" cellspacing="0" border="0" id="foo"
> >         class="mytableclass">
> >         <tr><td>\xc2\xa0</td>
> >         <td><input type="submit" class="submitbutton"></td>
> >         </tr></table></form>
> >
> >         The best way to muck around with that is in the tg-admin
> >         python shell.
> >         If you make a widget and then type it's name you'll see a long
> >         form of
> >         the contructor pop up:
> >
> >         In [56]: t = widgets.TextArea()
> >
> >         In [57]: t
> >         Out[57]: TextArea(name='widget', convert=True, rows=7,
> >         cols=50,
> >         attrs={}, css_classes=[], field_class='textarea')
> >
> >
> >         You can also use the intepreter to grab the template from the
> >         table from
> >         and make your own. That way you can really change the layout.
> >         And
> >         lastly, if that's enough you can subclass TableForm and put in
> >         your own
> >         templates and extra widget variables.
> >
> >         I've attached two widgets of my own, one simple one
> >         complicated.
> >         Attached as my email client screws up the formatting something
> >         fierce!
> >
> >         Iain
> >
> >
> >
> >
> >
> >
> >
> >
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to