The form element creates a form for user input. A form can contain elements such as textfields, checkboxes and radio-buttons. Forms are used to pass user data to a specified URL. If an upload
(self, cssClass=None, name=None, enctype="multipart/form-data",
action=None, role=None, method=None, onsubmit=None, onreset=None,
target=None, style=None, cssId=None)
| 1755 | # |
| 1756 | |
| 1757 | def form(self, cssClass=None, name=None, enctype="multipart/form-data", |
| 1758 | action=None, role=None, method=None, onsubmit=None, onreset=None, |
| 1759 | target=None, style=None, cssId=None): |
| 1760 | """The form element creates a form for user input. A form can contain |
| 1761 | elements such as textfields, checkboxes and radio-buttons. Forms are |
| 1762 | used to pass user data to a specified URL. |
| 1763 | |
| 1764 | <www href="http://www.w3schools.com/tags/tag_form.asp" target="external"/> |
| 1765 | |
| 1766 | If an upload tag is used in the form, then the enctype attribute should |
| 1767 | be set to enctype="multipart/form-data". |
| 1768 | |
| 1769 | self.form(action=e['path']) |
| 1770 | ... |
| 1771 | self._form() |
| 1772 | |
| 1773 | """ |
| 1774 | # |
| 1775 | # @class_ |
| 1776 | # @method GET | POST (default: POST) |
| 1777 | # @action (default: e['path']) |
| 1778 | # @onsubmit |
| 1779 | # @onreset |
| 1780 | # @enctype |
| 1781 | # @target |
| 1782 | # |
| 1783 | if method is None: |
| 1784 | method = 'POST' |
| 1785 | if action is None: |
| 1786 | action = self.e['path'] |
| 1787 | self.write('<form method="%s" action="%s"' % (method, action)) |
| 1788 | if cssClass is not None: |
| 1789 | self.write(' class="%s"' % cssClass) |
| 1790 | if cssId is not None: |
| 1791 | self.write(' id="%s"' % cssId) |
| 1792 | if role is not None: |
| 1793 | self.write(' role="%s"' % role) |
| 1794 | if name is not None: |
| 1795 | self.write(' name="%s"' % name) |
| 1796 | if onsubmit is not None: |
| 1797 | self.write(' onsubmit="%s"' % onsubmit) |
| 1798 | if enctype is not None: |
| 1799 | self.write(' enctype="%s"' % enctype) |
| 1800 | if style is not None: |
| 1801 | self.write(' style="%s"' % style) |
| 1802 | self.write(' accept-charset="utf-8">') |
| 1803 | # Push as last, so we can see the current tag on the stack |
| 1804 | self._pushTag('form') |
| 1805 | |
| 1806 | def _form(self): |
| 1807 | self._closeTag('form') |