Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57eb1d5

Browse files
Form modern widget
1 parent 4485445 commit 57eb1d5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/bevyframe/Widgets/Templates/Inputs.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,17 @@ def __init__(self, selector: str = '', **kwargs) -> None:
9696
super().__init__('button', selector=f'button {selector}', **kwargs)
9797

9898

99-
class Form(Widget):
100-
def __init__(self, method: str, children: list) -> None:
101-
super().__init__('form', method=method, children=children)
99+
class Form:
100+
def __init__(self, method: str, children: list, action: str = None) -> None:
101+
self.method = method
102+
self.children = children
103+
self.action = action if action else ''
104+
105+
def bf_widget(self) -> list[str | dict | list]:
106+
if self.action:
107+
return Widget('form', method=self.method, children=self.children, action=self.action).bf_widget()
108+
else:
109+
return Widget('form', method=self.method, children=self.children).bf_widget()
102110

103111

104112
class Method:

0 commit comments

Comments
 (0)