From fa88b521eb90cc07d00548c91fc4da027899609c Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Tue, 27 Jun 2023 14:12:05 +0300 Subject: [PATCH 1/2] Enabled passing through valid HTML form attributes to forms in ExpressionEngine as tag parameters --- docs/_tips/form-attributes.md | 1 + docs/add-ons/consent.md | 2 ++ docs/add-ons/email.md | 2 ++ docs/add-ons/search/advanced.md | 2 ++ docs/add-ons/search/simple.md | 2 ++ docs/channels/channel-form/overview.md | 2 ++ docs/comment/form.md | 2 ++ docs/config/config-files.md | 6 ++++++ docs/development/legacy/libraries/functions.md | 2 ++ docs/member/edit-avatar.md | 2 ++ docs/member/edit-profile.md | 2 ++ docs/member/login.md | 2 ++ docs/member/logout.md | 4 ++-- docs/member/memberlist.md | 2 ++ docs/member/registration.md | 2 ++ 15 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 docs/_tips/form-attributes.md diff --git a/docs/_tips/form-attributes.md b/docs/_tips/form-attributes.md new file mode 100644 index 000000000..c71543ebb --- /dev/null +++ b/docs/_tips/form-attributes.md @@ -0,0 +1 @@ +TIP: Valid HTML Form attributes (as listed in the [config file](config/config-files.md#html-form-attributes)), `data-` and `aria-` attributes passed through ExpressionEngine tag parameters in the template will be included into generated opening form tag. \ No newline at end of file diff --git a/docs/add-ons/consent.md b/docs/add-ons/consent.md index 1f46cd009..3ba9e104c 100755 --- a/docs/add-ons/consent.md +++ b/docs/add-ons/consent.md @@ -40,6 +40,8 @@ Consent Forms allow the visitor to grant or withdraw consent to one or more Cons [TOC=3] +{{embed:_tips/form-attributes.md}} + #### `consent=` consent='ee:cookies_functionality' diff --git a/docs/add-ons/email.md b/docs/add-ons/email.md index 16e8b1c11..3afec336c 100755 --- a/docs/add-ons/email.md +++ b/docs/add-ons/email.md @@ -56,6 +56,8 @@ The contact form is created similar to a standard web form, only you **do not** [TOC=3] +{{embed:_tips/form-attributes.md}} + ### `charset=` charset="utf-8" diff --git a/docs/add-ons/search/advanced.md b/docs/add-ons/search/advanced.md index 652ee127d..76207ca6d 100755 --- a/docs/add-ons/search/advanced.md +++ b/docs/add-ons/search/advanced.md @@ -143,6 +143,8 @@ The search results are displayed on the page you specify as the [result_page=](# [TOC=3] +{{embed:_tips/form-attributes.md}} + ### `category=` category="1" diff --git a/docs/add-ons/search/simple.md b/docs/add-ons/search/simple.md index fc79b8712..664183b6d 100755 --- a/docs/add-ons/search/simple.md +++ b/docs/add-ons/search/simple.md @@ -73,6 +73,8 @@ Besides specifying whether future entries are included in the search using the [ ## Parameters +{{embed:_tips/form-attributes.md}} + ### `name=` name="search_form" diff --git a/docs/channels/channel-form/overview.md b/docs/channels/channel-form/overview.md index 8e7826f29..4a866b93d 100755 --- a/docs/channels/channel-form/overview.md +++ b/docs/channels/channel-form/overview.md @@ -61,6 +61,8 @@ By default, validation errors will be displayed using the User Message Template. [TOC=3 hide] +{{embed:_tips/form-attributes.md}} + The Following parameters are available for the `{exp:channel:form}`: ### `allow_comments=` diff --git a/docs/comment/form.md b/docs/comment/form.md index e3c0650df..5fe92dd40 100755 --- a/docs/comment/form.md +++ b/docs/comment/form.md @@ -52,6 +52,8 @@ TIP: **Tip:** Notice the variables in the "value" form fields? These allow us to [TOC=4] +{{embed:_tips/form-attributes.md}} + #### `entry_id=` entry_id="24" diff --git a/docs/config/config-files.md b/docs/config/config-files.md index f2454ca98..fc5f74c51 100644 --- a/docs/config/config-files.md +++ b/docs/config/config-files.md @@ -29,6 +29,12 @@ The list of the words that are being used to generate [CAPTCHA](security/captcha This file contains an array of foreign characters for transliteration conversion used by the Text helper (example would be generating URL Titles for entries). +#### HTML Form Attributes + +`valid_form_attributes.php` + +Valid HTML attributes that might be passed via EE template tag parameters to the `form` tag when creating forms with `ee()->functions->form_declaration()`. Additionally, `data-` and `aria-` attributes can be used. + #### Allowed Mime Types `mimes.php` diff --git a/docs/development/legacy/libraries/functions.md b/docs/development/legacy/libraries/functions.md index 79f17753e..bcc9b7821 100755 --- a/docs/development/legacy/libraries/functions.md +++ b/docs/development/legacy/libraries/functions.md @@ -126,6 +126,8 @@ Any form will accept the `form_class` and `form_id` parameters. Access the value $r = ee()->functions->form_declaration($form_details); +{{embed:_tips/form-attributes.md}} + ### `form_backtrack([$offset = ''])` | Parameter | Type | Description | diff --git a/docs/member/edit-avatar.md b/docs/member/edit-avatar.md index 0d75ac566..77845ef7e 100644 --- a/docs/member/edit-avatar.md +++ b/docs/member/edit-avatar.md @@ -20,6 +20,8 @@ This tag allows users to edit their avatar image. The image will be uploaded to ## Parameters +{{embed:_tips/form-attributes.md}} + ### `return=` return="member/profile" diff --git a/docs/member/edit-profile.md b/docs/member/edit-profile.md index 5b5f57822..064e66dda 100644 --- a/docs/member/edit-profile.md +++ b/docs/member/edit-profile.md @@ -17,6 +17,8 @@ Edit member profile. ## Parameters +{{embed:_tips/form-attributes.md}} + ### `datepicker=` Include the datepicker javascript. This should be set to ``yes`` if there is a date type member custom field in order to output the calendar. diff --git a/docs/member/login.md b/docs/member/login.md index ce33d2cd9..7d7023a73 100644 --- a/docs/member/login.md +++ b/docs/member/login.md @@ -28,6 +28,8 @@ Output a login form. ## Parameters +{{embed:_tips/form-attributes.md}} + ### `action=` action="https://example.com/" diff --git a/docs/member/logout.md b/docs/member/logout.md index 1b9b8b203..af8ce4dea 100644 --- a/docs/member/logout.md +++ b/docs/member/logout.md @@ -33,6 +33,8 @@ Output a log out form. ## Parameters +{{embed:_tips/form-attributes.md}} + ### `action=` action="https://example.com/" @@ -65,5 +67,3 @@ This parameter allows you to define where the user will be returned after succes 1. Use the standard Template_Group/Template syntax to specify where to return the user. For instance, if you want the user to be returned to the "local" Template in the "news" Template Group, you would use: return="news/local" 2. Use a full URL. For example: return="" - - diff --git a/docs/member/memberlist.md b/docs/member/memberlist.md index cea7b4100..3b33bd73b 100644 --- a/docs/member/memberlist.md +++ b/docs/member/memberlist.md @@ -17,6 +17,8 @@ Outputs a searchable list of members, including form filters to sort and limit t ## Parameters +{{embed:_tips/form-attributes.md}} + ### `return=` return="member/memberlist" diff --git a/docs/member/registration.md b/docs/member/registration.md index a03160871..5b59f6f08 100644 --- a/docs/member/registration.md +++ b/docs/member/registration.md @@ -19,6 +19,8 @@ NOTE: **Important:** In order for site visitors to be allowed to register for ac ## Parameters +{{embed:_tips/form-attributes.md}} + ### `return=` return="member/registration/success" From f1f46683d61c55fed7a525780cce8feb52cb559f Mon Sep 17 00:00:00 2001 From: Bryan Nielsen Date: Thu, 8 Feb 2024 12:30:48 -0500 Subject: [PATCH 2/2] Update config-files.md --- docs/config/config-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/config/config-files.md b/docs/config/config-files.md index fc5f74c51..1e6568131 100644 --- a/docs/config/config-files.md +++ b/docs/config/config-files.md @@ -33,7 +33,7 @@ This file contains an array of foreign characters for transliteration conversion `valid_form_attributes.php` -Valid HTML attributes that might be passed via EE template tag parameters to the `form` tag when creating forms with `ee()->functions->form_declaration()`. Additionally, `data-` and `aria-` attributes can be used. +A list of HTML attributes that are allowed to be passed via EE template tag parameters to the `form` tag when creating forms with `ee()->functions->form_declaration()`. Additionally, attributes prefixed with `data-` and `aria-` can be used. #### Allowed Mime Types