# Catch original form value for comparing to submitted value

**URL:** https://forums.knack.com/t/catch-original-form-value-for-comparing-to-submitted-value/11660
**Category:** Ask Developers
**Created:** [December 3, 2021, 5:42pm UTC](https://forums.knack.com/t/catch-original-form-value-for-comparing-to-submitted-value/11660 "2021-12-03T17:42:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)
#### Post date: [December 3, 2021, 5:42pm UTC](https://forums.knack.com/t/catch-original-form-value-for-comparing-to-submitted-value/11660/1 "2021-12-03T17:42:41Z")

</div>

From a Form, I need to catch a particular field value BEFORE the form is submitted so that I can compare it to the submitted value and do something with the difference (ie original value was 20, new value is 15, I am going to do something with 5).

I can do the After, but not the Before.

I am listening on the view render, but there is no record yet for me to grab. Am I listening to the wrong thing? This is a single record form, not a inline-editable table.

```auto
$(document).on('knack-view-render.view_336', function(event, view, data) {
    
    //Pausing to let the records load doesn't help
    
    var MyOriginalPortion = record["field_100"]; // THIS LINE DOES NOT WORK
    console.log(MyOriginalPortion);
        
    $(document).on('knack-form-submit.view_336', function(event, view, record) {    
      
            var PaymentRecordID = record.id;
            var ThisActivityID = record["field_199"]; // ActivityID field in Payments Table 
            
            var MyNewPortion = record["field_100"]; // THIS LINE WORKS FINE
            console.log("Mew Portion: " + MyNewPortion);

// bla bla bla
            

```

---

<div class="post-metadata">

### Author: ![BradStevens](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/bradstevens/32/140_2.png) [@BradStevens](https://forums.knack.com/u/BradStevens)
#### Post date: [December 5, 2021, 9:51pm UTC](https://forums.knack.com/t/catch-original-form-value-for-comparing-to-submitted-value/11660/2 "2021-12-05T21:51:09Z")

</div>

Use the ‘data’ variable returned inside your view render (not ‘record’).  
`var MyOriginalPortion = data.field_100;`

---

<div class="post-metadata">

### Author: ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)
#### Post date: [December 6, 2021, 2:27pm UTC](https://forums.knack.com/t/catch-original-form-value-for-comparing-to-submitted-value/11660/3 "2021-12-06T14:27:41Z")

</div>

> [@BradStevens](#):
>
> data.field\_100

Yep that was what I needed! Thanks!
