# Can we dynamically display form fields on we web based on the object key values?

**URL:** <https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356>\
**Category:** How do I?\
**Created:** [June 26, 2024, 1:12pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356 "2024-06-26T13:12:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [June 26, 2024, 1:12pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/1 "2024-06-26T13:12:45Z")

</div>

Can we dynamically display form fields on we web based on the object key values?

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [June 26, 2024, 2:06pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/2 "2024-06-26T14:06:31Z")

</div>

Yes. Bind the form field’s display to the object key value. if the value is != null or “”, then display the form field.

---

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [June 26, 2024, 2:14pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/3 "2024-06-26T14:14:30Z")

</div>

Did not get your solution  
What actually i want is assume i have a object like this

{  
‘modelName’:{  
‘type’:‘text’,  
‘value’:‘test’  
},  
‘description’:{  
‘type’:‘input’,  
‘value’:‘test’  
}  
}  
based on the type i want to render the fields is this possible?

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [June 26, 2024, 2:43pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/4 "2024-06-26T14:43:40Z")

</div>

Yes. So for example I want this form field to be displayed only when id is 1162.

So I bind the display as such:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/02fe86a686eaf775cdd63d85d63a8f95ce25a832.png)

---

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [June 26, 2024, 2:44pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/5 "2024-06-26T14:44:52Z")

</div>

can we also mention the type like input field or text fields?

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [June 26, 2024, 2:51pm UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/6 "2024-06-26T14:51:53Z")

</div>

Not getting you, but you can bind to the type key of your object variable too!

---

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [June 27, 2024, 4:23am UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/7 "2024-06-27T04:23:31Z")

</div>

@raelyn Here we have this input type this is set to short answer now in case we supply this type from an object say like this  
{  
‘modelName’:{  
‘type’:‘short answer’,  
‘value’:‘test’  
},  
‘description’:{  
‘type’:‘input’,  
‘value’:‘test’  
}  
}  
from the above object can we set the type of form field?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/46b2d6f554c25c683f023f78f85674f817939435.png)

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [June 27, 2024, 5:04am UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/8 "2024-06-27T05:04:23Z")

</div>

No. The only way is to create both types of form field and then display it according to the type value.

---

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [July 1, 2024, 11:33am UTC](https://community.weweb.io/t/can-we-dynamically-display-form-fields-on-we-web-based-on-the-object-key-values/9356/9 "2024-07-01T11:33:17Z")

</div>

@raelyn Do we have any other way to achieve this  
The form details based on data type  
like example from backend we get data type as text then we insert a text field in form  
in case we get data type as input we can insert a input field in the form can we have the form dynamically rendered ?
