Enforce Node edit dialog TypedInput

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?

<script type="text/javascript">
        category: '_SMS_',
        color: '#3FADB5',
	paletteLabel: "Phone Number",
        defaults: {
            name: {value:""},
	    number: {value:""}	
        icon: "font-awesome/fa-phone",
        label: function() {
            return this.name + " " + this.number||"Phone Number";
	oneditprepare: function(){
    		typeField: "#node-input-number-type"

<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 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">
<type="text/html" data-help-name="phonenumber">
    <p>Enter Phone Number</p>

Hi @JohnnyPicnic,
And if you change your input type from "text" to "number" (see here)?

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

Yup that did it.
Thank you!

1 Like

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