# Bind javascript value to Change

**URL:** <https://forums.fusetools.com/t/bind-javascript-value-to-change/1891>\
**Category:** How-to Discussions\
**Created:** [May 16, 2016, 3:48am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891 "2016-05-16T03:48:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [May 16, 2016, 3:48am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891/1 "2016-05-16T03:48:53Z")

</div>

Hi guys , i’m building a little progress bar, things was goin pretty well before decided to bind a value in change

```auto
    <JavaScript>
        var value = 200;
        module.exports = {
                    value : value
            };
    </JavaScript>
  <ClientPanel Background="Gray">
        <StackPanel>
            <Panel Height="200"/>
            <Rectangle CornerRadius="4" Height="20" Width="80%" Color="Green">
                <Rectangle ux:Name="progress" CornerRadius="4" Height="100%" Width="20%" Alignment="Left" Color="Red" />
            </Rectangle>
            <Button>
                <Clicked>
                    <Set ProgressBar.Value="true"/>
                </Clicked>
            </Button>
            <WhileTrue ux:Name="ProgressBar">
                <Change progress.Width="{value}" Easing="QuadraticIn" Duration="0.7"/>
            </WhileTrue>
        </StackPanel>
        <Panel></Panel>
  </ClientPanel>

```

so this is what i’m doin , i want the WhileTrue to be effective with the binded value is that possible? Doin this i’m having a issue cannot parse ‘{value}’ as ‘uno.UX.Size’ Input string was not in the correct format. Can anyone explain me how can i interact with javascript

---

<div class="post-metadata">

**Author:** ![Edwin\_Reynoso](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Edwin\_Reynoso](https://forums.fusetools.com/u/Edwin_Reynoso)\
**Post date:** [May 16, 2016, 10:48am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891/2 "2016-05-16T10:48:41Z")

</div>

`WhileTrue` has a `Value` property that you can bind to an `Observable`

---

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [May 16, 2016, 11:14am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891/3 "2016-05-16T11:14:54Z")

</div>

Hi, Thanks for your anwser but i dont understand how you will get this running using `Value={something}` Don’t want the animation to be played while a case is true or not, want to bind a value to change in this WhileTrue (here the width) so the animation can be played.

If your anwser cover my need please explain in detail how can i achieve this.

Thank you

---

<div class="post-metadata">

**Author:** ![Edwin\_Reynoso](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Edwin\_Reynoso](https://forums.fusetools.com/u/Edwin_Reynoso)\
**Post date:** [May 16, 2016, 11:24am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891/4 "2016-05-16T11:24:06Z")

</div>

```auto
<App>
    <JavaScript>
            var value = 100;
            module.exports = {
                        value : value
                };
        </JavaScript>
<ClientPanel Background="Gray">
    <StackPanel>
        <Panel Height="200" />
        <Rectangle CornerRadius="4" Height="20" Width="80%" Color="Green">
            <Rectangle ux:Name="progress" CornerRadius="4" Height="100%" Width="20%" Alignment="Left" Color="Red" />
        </Rectangle>
        <Button Text="Change">
            <Clicked>
                <Toggle Target="ProgressBar" />
            </Clicked>
        </Button>
        <WhileTrue ux:Name="ProgressBar">
            <Change Target="progress.Width" Value="{value}" Easing="QuadraticIn" Duration="0.7" />
        </WhileTrue>
    </StackPanel>
    <Panel></Panel>
</ClientPanel>

</App>

```

I’d suggest sticking to this way of writing `Change`:

```auto
<Change Target="SomeProperty" Value="SomeValue" />

```

Compare to:

```auto
<Change SomeProperty="SomeValue" />

```

---

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [May 16, 2016, 11:29am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891/5 "2016-05-16T11:29:42Z")

</div>

Wooo that’s fantastic Many thanks Edwin , didnt see things like this

---

<div class="post-metadata">

**Author:** ![Edwin\_Reynoso](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Edwin\_Reynoso](https://forums.fusetools.com/u/Edwin_Reynoso)\
**Post date:** [May 16, 2016, 11:37am UTC](https://forums.fusetools.com/t/bind-javascript-value-to-change/1891/6 "2016-05-16T11:37:01Z")

</div>

No problem
