# Request: JS Code to Make Phone Field Optional | Collect Contacts Agent Skill

**URL:** <https://community.elfsight.com/t/request-js-code-to-make-phone-field-optional-collect-contacts-agent-skill/172519>\
**Category:** Customization\
**Tags:** ai-chatbot\
**Created:** [August 24, 2026, 6:46pm UTC](https://community.elfsight.com/t/request-js-code-to-make-phone-field-optional-collect-contacts-agent-skill/172519 "2026-08-24T18:46:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petar\_Dietrich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/petar_dietrich/32/92003_2.png) [@Petar\_Dietrich](https://community.elfsight.com/u/Petar_Dietrich)\
**Post date:** [August 24, 2026, 6:46pm UTC](https://community.elfsight.com/t/request-js-code-to-make-phone-field-optional-collect-contacts-agent-skill/172519/1 "2026-08-24T18:46:06Z")

</div>

Hello Team,

Can you provide a JS code that will allow me to make the phone field optional under the condition noted below?

**Reason:** When using the “ **Require before agent’s answer** ” option, all of the fields (Name, Phone Number, Email, and Consent Checkbox) are required fields before the agent replies. However, not everyone is comfortable submitting their phone number under this condition. I would still like to offer the Phone Number option without making it mandatory. Makes sense?

Thank you!

* * *

 ![agent-skill-require-before-js-code-phone-optional](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/2/2/227c200357301e05728374907d6167ea86ecc259.jpeg)

---

<div class="post-metadata">

**Author:** ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)\
**Post date:** [August 24, 2026, 7:03pm UTC](https://community.elfsight.com/t/request-js-code-to-make-phone-field-optional-collect-contacts-agent-skill/172519/3 "2026-08-24T19:03:17Z")

</div>

Hi Petar,

I’ve shared your request with the dev team and will get back to you with the news tomorrow 🙂

---

<div class="post-metadata">

**Author:** ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)\
**Post date:** [August 25, 2026, 10:46am UTC](https://community.elfsight.com/t/request-js-code-to-make-phone-field-optional-collect-contacts-agent-skill/172519/4 "2026-08-25T10:46:44Z")

</div>

Hello Petar,

Unfortunately, this customization isn’t possible at the moment. I am really sorry!

I’ve added this idea to the Wishlist and if it gets more votes, we’ll try to consider it in the future updates: [Make Phone field optional when form completion is required before agent's response](https://community.elfsight.com/t/make-phone-field-optional-when-form-completion-is-required-before-agents-response/172575)
