# Number input form field with associated step arrows/buttons

**URL:** <https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560>\
**Category:** How do I?\
**Created:** [July 17, 2023, 4:15pm UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560 "2023-07-17T16:15:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericp](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ericp](https://community.weweb.io/u/ericp)\
**Post date:** [July 17, 2023, 4:15pm UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/1 "2023-07-17T16:15:26Z")

</div>

I’m building a form that field service users will use during site inspections. I have a field that represents the count of items that they see during the inspection. The final count may not be known until the end of the inspection, so it is convenient to step-change the count during the process.

In the past, I’ve used a star-rating field as a work-around. Wondering if there is a more elegant way of doing this with something like a integer field that has large up/down arrows next to it that can step change the value in real time.

I know the default number field can show the arrows, but you have to click into the field and the arrows are the same size as the integer. My users will be entered data into the forms via tablet/phone.

---

<div class="post-metadata">

**Author:** ![Quentin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/quentin/32/6_2.png) [@Quentin](https://community.weweb.io/u/Quentin)\
**Post date:** [July 18, 2023, 9:38am UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/2 "2023-07-18T09:38:21Z")

</div>

I think the best way would be to design your own arrows, then add workflows to them that will update a value which is bound to the number input.

Then, when clicking an arrow, it’ll change the input’s value on the fly, while the input still remains updatable.

---

<div class="post-metadata">

**Author:** ![ericp](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ericp](https://community.weweb.io/u/ericp)\
**Post date:** [July 18, 2023, 1:23pm UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/3 "2023-07-18T13:23:31Z")

</div>

Thanks, I’ll give it a try.

---

<div class="post-metadata">

**Author:** ![Jean](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/jean/32/4106_2.png) [@Jean](https://community.weweb.io/u/Jean)\
**Post date:** [July 21, 2023, 8:19pm UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/4 "2023-07-21T20:19:11Z")

</div>

Hi Quentin,

Thanks for the info. So I’ve done something like that to customise a number input. On display it does change the value of the number input but when I go to submit my form or when entering the number input with the mouse it resets the value to the default one. Screen Rec of the issue below.

> **[21.07.2023\_21.14.57\_REC](https://screenrec.com/share/8G2BWdJtqD)**
>
> Recorded with ScreenRec

Below is the JS on the button (generated with your AI btw)  
// Get the input element by its id  
let inputElement = document.getElementById(“number”);

// Check if the input element exists and it’s a number  
if (inputElement && !isNaN(inputElement.value)) {  
// Decrement the value by 1  
inputElement.value = Number(inputElement.value) - 1;  
}

// Return the updated value  
return inputElement.value;

Any tip would be much appreciated.

Thanks,  
Jean

---

<div class="post-metadata">

**Author:** ![Jean](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/jean/32/4106_2.png) [@Jean](https://community.weweb.io/u/Jean)\
**Post date:** [August 15, 2023, 12:25pm UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/5 "2023-08-15T12:25:51Z")

</div>

@Joyce or @Quentin would you be able to help with the above please? What am I missing ?

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [August 17, 2023, 11:22am UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/6 "2023-08-17T11:22:57Z")

</div>

Mmm can’t really help with the JS but I tried it in no-code and seems to work fine: [Jean - amount with arrow — Tella](https://tella.video/jean-amount-with-arrow-bq9n)

Does that help @Jean?

---

<div class="post-metadata">

**Author:** ![Jean](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/jean/32/4106_2.png) [@Jean](https://community.weweb.io/u/Jean)\
**Post date:** [August 31, 2023, 9:53am UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/7 "2023-08-31T09:53:33Z")

</div>

Because I wasn’t using the arrows built-in the default component I was struggling, but thanks to your help and the video, I ditched the JS, used a new variable and no-code and it’s now working. Thank you Joyce.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [August 31, 2023, 10:56am UTC](https://community.weweb.io/t/number-input-form-field-with-associated-step-arrows-buttons/3560/8 "2023-08-31T10:56:00Z")

</div>

You’re complicating this by using JavaScript DOM modification vs Vue.js state. You gotta set a workflow to change the [number input].value via a WeWeb Workflow like this (but with a number input - I don’t have any on hand)

 ![Screenshot 2023-08-31 at 12.55.08](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e0bbc69bdf55e036708f0a977dc8707bc040b490.png)

You should never change the html document via vanilla JS, as it causes bugs like this.
