# Enforce Node edit dialog TypedInput

**URL:** <https://discourse.nodered.org/t/enforce-node-edit-dialog-typedinput/52828>\
**Category:** Developing Nodes\
**Created:** [27 October 2021 13:24 UTC](https://discourse.nodered.org/t/enforce-node-edit-dialog-typedinput/52828 "2021-10-27T13:24:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [27 October 2021 13:24 UTC](https://discourse.nodered.org/t/enforce-node-edit-dialog-typedinput/52828/1 "2021-10-27T13:24:26Z")

</div>

I created a node that has a number input field.  
When text or characters are entered the input box highlights red but i'm still able to deploy.  
Is there a way to enforce a number only input field?

```auto
<script type="text/javascript">
    RED.nodes.registerType('phonenumber',{
        category: '_SMS_',
        color: '#3FADB5',
	paletteLabel: "Phone Number",
        defaults: {
            name: {value:""},
	    number: {value:""}	
        },
        inputs:1,
        outputs:1,
        icon: "font-awesome/fa-phone",
        label: function() {
            return this.name + " " + this.number||"Phone Number";
        },
	oneditprepare: function(){
		$("#node-input-number").typedInput({
   		 type:"num",
    		types:["num"],
    		typeField: "#node-input-number-type"
	})
	}
    });
</script>

<script type="text/html" data-template-name="phonenumber">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-user"></i>Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-number"><i class="fa fa-mobile"></i>Number</label>
        <input type="text" id="node-input-number" placeholder="17801234567">
	<input type="hidden" id="node-input-number-type">
    </div>
</script>
<type="text/html" data-help-name="phonenumber">
    <p>Enter Phone Number</p>
</script>

```

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [27 October 2021 15:49 UTC](https://discourse.nodered.org/t/enforce-node-edit-dialog-typedinput/52828/2 "2021-10-27T15:49:40Z")

</div>

Hi @JohnnyPicnic,  
And if you change your input type from "text" to "number" (see [here](https://www.w3schools.com/tags/att_input_type_number.asp))?  
Bart

[EDIT] Now I am doubting whether it should be "text" always for a TypedInput. But cannot test at this moment...

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [27 October 2021 16:40 UTC](https://discourse.nodered.org/t/enforce-node-edit-dialog-typedinput/52828/3 "2021-10-27T16:40:25Z")

</div>

Yup that did it.  
Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 November 2021 16:41 UTC](https://discourse.nodered.org/t/enforce-node-edit-dialog-typedinput/52828/4 "2021-11-10T16:41:08Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
