Skip to content

Commit

Permalink
better RadioWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Jun 15, 2024
1 parent dc80726 commit 1b02e8a
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions py4web/utils/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,16 @@ def make(self, field, value, error, title, placeholder="", readonly=False):
if k != ""
]
for k, v, selected in field_options:
_id = "%s%s" % (field_id, k)
control.append(
INPUT(
v,
_id=_id,
_value=k,
_label=v,
_name=field.name,
_type="radio",
_checked=selected,
)
_id = "%s-%s" % (field_id, k)
inp = INPUT(
_id=_id,
_value=k,
_label=v,
_name=field.name,
_type="radio",
_checked=selected,
)
control.append(LABEL(v, _for=_id))
control.append(LABEL(inp, " ", v))
return control


Expand Down Expand Up @@ -321,11 +318,11 @@ def __call__(
**kwargs,
)

class_label = self.classes["label"]
class_outer = self.classes["outer"]
class_inner = self.classes["inner"]
class_error = self.classes["error"]
class_info = self.classes["info"]
class_label = self.classes.get("label") or None
class_outer = self.classes.get("outer") or None
class_inner = self.classes.get("inner") or None
class_error = self.classes.get("error") or None
class_info = self.classes.get("info") or None

all_fields = [x for x in table]
if "_virtual_fields" in dir(table):
Expand Down Expand Up @@ -645,7 +642,6 @@ def __call__(
}
)


# ################################################################
# Form object (replaced SQLFORM)
# ################################################################
Expand Down

0 comments on commit 1b02e8a

Please sign in to comment.