Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Form Capture Not Working for Number Fields

(0) ShareShare
ReportReport
Posted on by 45

When I try to do a form capture on a form with number fields, the number fields do not show up to be mapped?? Every other field works. Anyone else find this, workaround?

  • Suggested answer
    RE: Form Capture Not Working for Number Fields

    Hi, 

    Thank you for your question.
    This isn
    t an expected behavior. Please file a support ticket to ensure we can assist in a timely manner.

    Thanks,
    Defne

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Form Capture Not Working for Number Fields

    Hi Mongstone,

    Could the code work for you?

    Regards,

    Clofly

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Form Capture Not Working for Number Fields

    Hi Mongstone,

    Thanks for your feedback, I reproduced your issue in two different environments, it seems that it was a bug.

    Workaround:

    If the field you want to map is phone number, you could change type to "tel".

    Or set type to text, and run a custom javascript function for your field to only allow number input.

    Here is my validation function, it will insert an error message text after the field, and the string value will be cleared after 1 seconds.

    If the input value is number, then remove the error text.

    pastedimage1598593991141v1.png

    You could assign an id to the field that you want to only allow number, replace the "phone" with that id to test whether it could work for you.

    document.getElementById("phone").addEventListener("focusout", validate);
    
    function validate() {
        if (this.value !== "") {
            if (/^\d $/.test(this.value) === false) {
              createErrorMsg(this.id, "Only number is allowed.")
            } else {
              eraseErrorMsg(this.id);
            }
        }
    }
    
    function createErrorMsg(id, msg) {
        eraseErrorMsg(id);
        var error = document.createElement("p");
        error.setAttribute("id", id   "-error");
        error.style.color = "red";
        error.innerText = msg;
        document.getElementById(id).parentNode.appendChild(error);
        setTimeout(function () {
            document.getElementById(id).value = "";
        }, 1000);
    }
    
    function eraseErrorMsg(id) {
       var error = document.getElementById(id   "-error");
       if (error) {
         error.remove();
       }
    }

    Regards,

    Clofly

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans