Preserve selected recipient if validation of contact form fails
authorMatthias Schmidt <gravatronics@live.com>
Mon, 6 May 2019 16:53:27 +0000 (18:53 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 6 May 2019 16:53:27 +0000 (18:53 +0200)
com.woltlab.wcf/templates/contact.tpl
wcfsetup/install/files/lib/form/ContactForm.class.php

index 16d30da3a83fc9c9a7ead7a10c98afd90bddcbb0..b82458451396381f62c4ddc33ae4ff8839194011 100644 (file)
@@ -51,7 +51,7 @@
                                        <select name="recipientID" id="recipientID">
                                                <option value="">{lang}wcf.global.noSelection{/lang}</option>
                                                {foreach from=$recipientList item=recipient}
-                                                       <option value="{@$recipient->recipientID}">{$recipient}</option>
+                                                       <option value="{@$recipient->recipientID}"{if $recipient->recipientID == $recipientID} selected{/if}>{$recipient}</option>
                                                {/foreach}
                                        </select>
                                        {if $errorField == 'recipientID'}
index 6b6c2def0359154314bf8163bae149748f555632..5316132c2686b67b85d78d795e7d9802d3399fa4 100644 (file)
@@ -199,6 +199,7 @@ class ContactForm extends AbstractCaptchaForm {
                        'name' => $this->name,
                        'options' => $this->optionHandler->getOptions(),
                        'recipientList' => $this->recipientList,
+                       'recipientID' => $this->recipientID,
                        'privacyPolicyConfirmed' => $this->privacyPolicyConfirmed
                ]);
        }