# Form to edit only blank values

**URL:** <https://forums.knack.com/t/form-to-edit-only-blank-values/8498>\
**Category:** Get Answers\
**Created:** [March 19, 2020, 9:59am UTC](https://forums.knack.com/t/form-to-edit-only-blank-values/8498 "2020-03-19T09:59:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TanyaPlain86416](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@TanyaPlain86416](https://forums.knack.com/u/TanyaPlain86416)\
**Post date:** [March 19, 2020, 9:59am UTC](https://forums.knack.com/t/form-to-edit-only-blank-values/8498/1 "2020-03-19T09:59:53Z")

</div>

In an edit form is there a way to make 'read-only' applicable only to fields that have no value already entered.

Generally I have have clients enter data over a few periods, ie a preliminary stage and then final. There is however no consistency in what is presented in preliminary to final stage, thus can't just create two forms. Basically I don't want clients to be able to edit existing data, but add to fields where they have not previously added data.

I have tried working with form display 'show/hide' rules but not effective. Multiple forms on a page and rules getting too clunky. I guess I can add new fields to create true/false calc against each existing field, but this is going to expand my object considerably.

Any ideas?

---

<div class="post-metadata">

**Author:** ![TanyaPlain86416](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@TanyaPlain86416](https://forums.knack.com/u/TanyaPlain86416)\
**Post date:** [March 23, 2020, 2:59am UTC](https://forums.knack.com/t/form-to-edit-only-blank-values/8498/2 "2020-03-23T02:59:09Z")

</div>

Thanks! Will check it out.

---

<div class="post-metadata">

**Author:** ![Shrey](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@Shrey](https://forums.knack.com/u/Shrey)\
**Post date:** [March 19, 2020, 4:47pm UTC](https://forums.knack.com/t/form-to-edit-only-blank-values/8498/3 "2020-03-19T16:47:58Z")

</div>

114151245992&nbsp;Try this JS code:  
  
document.querySelectorAll("#view\_XX input").forEach(field =\> {if(field.value !== "") field.setAttribute('readonly',true)});
