From 23208d1ade5b4982a59c6c77f3002ff74d65eec4 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Sun, 17 Mar 2019 07:43:20 -0400 Subject: [PATCH] Update InputfieldSubmit to support disabling of populating selected dropdown value to submit button value --- .../InputfieldSubmit/InputfieldSubmit.module | 14 +++++++++++--- .../Inputfield/InputfieldSubmit/dropdown.js | 14 ++++++++++++-- .../Inputfield/InputfieldSubmit/dropdown.min.js | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module b/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module index 69011347..1c3f8802 100644 --- a/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module +++ b/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module @@ -10,7 +10,8 @@ * @property bool $header Whether or not button will also appear in header (default=false). * @property bool $secondary Whether or not button is secondary (default=false). * @property bool $small Whether or not button should be small, where supported (default=false). - * @property string $dropdownInputName #pw-internal + * @property string $dropdownInputName Name of input to receive selected dropdown value (default='_action_value') #pw-internal + * @property bool $dropdownSubmit Selected dropdown value becomes submit value? (default=true) #pw-internal * */ class InputfieldSubmit extends Inputfield { @@ -55,6 +56,10 @@ class InputfieldSubmit extends Inputfield { // name of 'hidden' input that will receive the clicked dropdown item value $this->set('dropdownInputName', '_action_value'); + + // Selected dropdown value becomes submit value? If set to false, then only the + // dropdownInputName above will contain the selected value + $this->set('dropdownSubmit', true); } public function set($key, $value) { @@ -209,8 +214,11 @@ class InputfieldSubmit extends Inputfield { if($numValues) { // there are values that can be populated to a hidden input $inputID = $dropdownID . '_value'; - $out = "" . - str_replace("