<p>So it turns out you can modify an existing property like this: </p>

<pre><code>$event-&gt;params['entry']-&gt;getContent()-&gt;existingProperty = 'new value';
</code></pre>

<p>What I ended up doing was using a hidden field and then updating the value of that from the sproutForms.onBeforeSaveEntry event:</p>

<pre><code>craft()-&gt;on('sproutForms.onBeforeSaveEntry', function(Event $event) {
    $entry = $event-&gt;params['entry'];
    $entry-&gt;getContent()-&gt;subscribeStatus = 'success';
});
</code></pre>

<p>Since that property can be set depending on what the response is from the cURL post, it's possible to deliver success/error messages to users on the thank you page and prevent the subscribe from silently failing in the background.</p>

CC BY-SA 3.0
2016-01-12T21:34:19.973Z
2016-01-12T21:34:19.973Z
Mark
<p>In the Sprout Forms plugin, is there a way to modify the EntryModel through sproutForms.onBeforeSaveEntry? I have a plugin that sends a cURL request onBeforeSaveEntry, and I'd like to grab the response from that and deliver it to the user on the thank you page. </p>

<p>I've tried setting new properties on the $event object but I'm getting errors, so maybe my approach is wrong? Been searching, but unable to find how to get it done. </p>

<plugins><plugin-sproutforms>
Sprout Forms: Modify Entry
# Sprout Forms: Modify Entry

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

In the Sprout Forms plugin, is there a way to modify the EntryModel through sproutForms.onBeforeSaveEntry? I have a plugin that sends a cURL request onBeforeSaveEntry, and I'd like to grab the response from that and deliver it to the user on the thank you page.

I've tried setting new properties on the $event object but I'm getting errors, so maybe my approach is wrong? Been searching, but unable to find how to get it done.

**Tags:** plugins, plugin-sproutforms

---

## 1 answers

### Answer by username_0 on 2016-01-12. Score: 2 | Accepted answer

So it turns out you can modify an existing property like this: 
$event->params['entry']->getContent()->existingProperty = 'new value';

What I ended up doing was using a hidden field and then updating the value of that from the sproutForms.onBeforeSaveEntry event:
craft()->on('sproutForms.onBeforeSaveEntry', function(Event $event) {
    $entry = $event->params['entry'];
    $entry->getContent()->subscribeStatus = 'success';
});

Since that property can be set depending on what the response is from the cURL post, it's possible to deliver success/error messages to users on the thank you page and prevent the subscribe from silently failing in the background.


---

