web/formwidgets.py
branchstable
changeset 9134 a5f53b023132
parent 8936 010adc548b97
child 9222 ec65ca70aac9
equal deleted inserted replaced
9133:5f85e5ecbdb0 9134:a5f53b023132
  1014 
  1014 
  1015     Note that `label` is a msgid which will be translated at form generation
  1015     Note that `label` is a msgid which will be translated at form generation
  1016     time, you should not give an already translated string.
  1016     time, you should not give an already translated string.
  1017     """
  1017     """
  1018     type = 'button'
  1018     type = 'button'
       
  1019     css_class = 'validateButton'
       
  1020 
  1019     def __init__(self, label=stdmsgs.BUTTON_OK, attrs=None,
  1021     def __init__(self, label=stdmsgs.BUTTON_OK, attrs=None,
  1020                  setdomid=None, settabindex=None,
  1022                  setdomid=None, settabindex=None,
  1021                  name='', value='', onclick=None, cwaction=None):
  1023                  name='', value='', onclick=None, cwaction=None):
  1022         super(Button, self).__init__(attrs, setdomid, settabindex)
  1024         super(Button, self).__init__(attrs, setdomid, settabindex)
  1023         if isinstance(label, tuple):
  1025         if isinstance(label, tuple):
  1028             self.icon = None
  1030             self.icon = None
  1029         self.name = name
  1031         self.name = name
  1030         self.value = ''
  1032         self.value = ''
  1031         self.onclick = onclick
  1033         self.onclick = onclick
  1032         self.cwaction = cwaction
  1034         self.cwaction = cwaction
  1033         self.attrs.setdefault('class', 'validateButton')
  1035         self.attrs.setdefault('class', self.css_class)
  1034 
  1036 
  1035     def render(self, form, field=None, renderer=None):
  1037     def render(self, form, field=None, renderer=None):
  1036         label = form._cw._(self.label)
  1038         label = form._cw._(self.label)
  1037         attrs = self.attrs.copy()
  1039         attrs = self.attrs.copy()
  1038         if self.cwaction:
  1040         if self.cwaction: