<p>As there was no simple answer that didn't require another plugin or javascript I revised my entry form to collect the date manually. Which is a bit of a pain, as the input format for the date has to be mm/dd/yyyy, which isn't normal in the UK.</p>

CC BY-SA 3.0
2016-03-10T00:35:06.560Z
Don't picture the Preparse plugin as "yet another plugin". It's a tool that actually should be part of every Craft install, so useful.
carlcs
CC BY-SA 3.0
2016-03-10T15:57:42.610Z
I'm coming from ExpressionEngine, and have been bitten by addons that are no longer supported and not updated, and so now I can't update the EE version. I don't want that to happen again. Part of Craft's attraction is that almost everything I want is part of the core so updating isn't a problem.
Paul Frost
CC BY-SA 3.0
2016-03-10T16:06:05.950Z
Have a look at all the maintainers: https://github.com/aelvan/Preparse-Field-Craft/commits/master. Brandon is a one of them and he's a big fan of that plugin. It's here to stay, even if Andre should remove it from GitHub, I bet there will be a replacement plugin within a few days.
carlcs
CC BY-SA 3.0
2016-03-09T21:14:11.917Z
2016-03-09T21:14:11.917Z
Paul Frost
<p>You could use the <a href="https://github.com/aelvan/Preparse-Field-Craft" rel="nofollow">Preparse plugin</a> to create a field that is automatically updated with the <code>eventDate</code> value whenever the entry is saved. It wouldn't be a datetime field, but if you stored the <em>timestamp</em> (i.e. <code>{{ dateString|date('U') }}</code>) it'd be easy to <em>use</em> as such.</p>

<p>Another option is to have an hidden input in your form for the <code>eventDate</code> datetime field, and use JavaScript to set its value whenever the <code>&lt;select&gt;</code> input changes (i.e. listen for the <code>change</code> event for the latter, in your JS).</p>

<p>The third option would be to write a plugin which listens to the <code>entries.beforeSaveEntry</code> event in order to set the <code>eventDate</code> value from the dropdown field.</p>

CC BY-SA 3.0
2016-03-10T00:39:08.957Z
Auto Expire plugin allows to copy to a Date/Time field.
carlcs
CC BY-SA 3.0
2016-03-02T08:34:54.713Z
2016-03-02T08:34:54.713Z
Mats Mikkel Rummelhoff
<p>I have the following code in my form, but I'd like to also save the eventDate of the selected entry into a separate date field to enable sorting/selection later.</p>

<pre><code>&lt;label for="eventName"&gt;Event
&lt;select id="eventName" name="fields[eventName]"&gt;  
  &lt;option value=""&gt;select from list&lt;/option&gt;
    {% set events = craft.entries.find({section:'events,activities', eventDate : "&gt;= " ~ now.w3cDate() , order:'eventDate'}) %}
    {% if events %}
        {% for entry in events %}                
            &lt;option value="{{ entry.eventDate.format('D j M') }},{{ entry.eventName }}"&gt;{{ entry.eventDate.format('D j M') }},{{ entry.eventName }}&lt;/option&gt;
        {% endfor %}
    {% endif %}
&lt;/select&gt;            
&lt;/label&gt;
</code></pre>

<form>
Possible to set 2 data fields within 1 select option?
# Possible to set 2 data fields within 1 select option?

(Asked by: username_0 on 2016-03-01)

I have the following code in my form, but I'd like to also save the eventDate of the selected entry into a separate date field to enable sorting/selection later.
Event
  
  select from list
    {% set events = craft.entries.find({section:'events,activities', eventDate : ">= " ~ now.w3cDate() , order:'eventDate'}) %}
    {% if events %}
        {% for entry in events %}                
            {{ entry.eventDate.format('D j M') }},{{ entry.eventName }}
        {% endfor %}
    {% endif %}

**Tags:** form

---

## 2 answers

### Answer by username_0 on 2016-03-09. Score: 0 | Accepted answer

As there was no simple answer that didn't require another plugin or javascript I revised my entry form to collect the date manually. Which is a bit of a pain, as the input format for the date has to be mm/dd/yyyy, which isn't normal in the UK.

> **Comments:**
> **username_1**: Don't picture the Preparse plugin as "yet another plugin". It's a tool that actually should be part of every Craft install, so useful.  
> **username_0**: I'm coming from ExpressionEngine, and have been bitten by addons that are no longer supported and not updated, and so now I can't update the EE version. I don't want that to happen again. Part of Craft's attraction is that almost everything I want is part of the core so updating isn't a problem.  
> **username_1**: Have a look at all the maintainers: https://github.com/aelvan/Preparse-Field-Craft/commits/master. Brandon is a one of them and he's a big fan of that plugin. It's here to stay, even if Andre should remove it from GitHub, I bet there will be a replacement plugin within a few days.  

---

### Answer by username_2 on 2016-03-02. Score: 2

You could use the [Preparse plugin](https://github.com/aelvan/Preparse-Field-Craft) to create a field that is automatically updated with the `eventDate` value whenever the entry is saved. It wouldn't be a datetime field, but if you stored the *timestamp* (i.e. `{{ dateString|date('U') }}`) it'd be easy to *use* as such.

Another option is to have an hidden input in your form for the `eventDate` datetime field, and use JavaScript to set its value whenever the  input changes (i.e. listen for the `change` event for the latter, in your JS).

The third option would be to write a plugin which listens to the `entries.beforeSaveEntry` event in order to set the `eventDate` value from the dropdown field.

> **Comments:**
> **username_1**: Auto Expire plugin allows to copy to a Date/Time field.  

---

