Commit 036782f5 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for image buttons.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19198 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 57f69927
...@@ -37,7 +37,7 @@ class InputButtonWidget(Widget.Widget): ...@@ -37,7 +37,7 @@ class InputButtonWidget(Widget.Widget):
Displays an input button. Displays an input button.
""" """
property_names = Widget.Widget.property_names + ['name', 'extra'] property_names = Widget.Widget.property_names + ['name', 'extra', 'image']
default = fields.StringField('default', default = fields.StringField('default',
title='Button text', title='Button text',
...@@ -58,14 +58,27 @@ class InputButtonWidget(Widget.Widget): ...@@ -58,14 +58,27 @@ class InputButtonWidget(Widget.Widget):
description=( description=(
"The CSS class of the field. This can be used to style your " "The CSS class of the field. This can be used to style your "
"formulator fields using cascading style sheets. Not required."), "formulator fields using cascading style sheets. Not required."),
default="hiddenLabel", default="hidden_label",
required=0) required=0)
image = fields.StringField('image',
title='Image',
description=(
"The image of the button (if any)."),
default='',
required=0)
def render(self, field, key, value, REQUEST): def render(self, field, key, value, REQUEST):
"""Render input button. """Render input button.
""" """
return Widget.render_element("input", image = field.get_value('image')
type="submit", if image:
html_type = "image"
else:
html_type = "submit"
return Widget.render_element('input',
type=html_type,
src=image,
name=field.get_value('name'), name=field.get_value('name'),
css_class=field.get_value('css_class'), css_class=field.get_value('css_class'),
value=field.get_value('default'), value=field.get_value('default'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment