Form node: making a text value read only

Hi Guys,
I have a form the user needs to input, but the first value on the form is a "transaction ID". This is a database generated unique value and though I want it to be displayed, I don't want the user to edit it. I haven't found a readonly attribute in the form config itself, so instead I pass msg.ui_update.options through a change node. It works fine, except for the readonly part. Here is the first few (pertinent) lines of the msg object:

    {
        "type": "text",
        "label": "Transaction No",
        "key": "txNum",
        "required": true,
        "readonly": true
    },
    {
        "type": "date",
        "label": "Date",
        "key": "txDate",
        "required": false
    },
    {
        "type": "time",
        "label": "Time",
        "key": "txTime",
        "required": false
    },
    {
        "type": "text",
        "label": "License Plate",
        "key": "txPlate",
        "required": false
    }

Changing the readonly attribute does nothing - I'm sure my error is going to be something elementary that I'm overlooking - any ideas?

From the docs readonly/disabled field support does not appear to be an option.

This is not an unreasonable request or use case.

You can raise a feature request here: Sign in to GitHub · GitHub - the developers are open to suggestions :slight_smile:

Indeed this is a worthy feature request.
For the time being, you can define this field as a read-only HTML tag in a template node, or a Markdown node (populated with {{...}} ). Will require an extra step in extracting & inserting it into the form 'submit' msg

Could you use the Label field?

Thanks for the super fast responses.
@Colin - Using the label field is a pretty good idea, though I'm not sure I can achieve the "slick" look with it.
@omrid - Thanks for the suggestion.
Seems I'm going to go with a separate Text output - pretty obvious workaround though ideally I wanted to retain the data in the form object as I thought this might be more elegant.
But after 2 aspirins and a short break I'll just go this way :wink:

Please do open a Feature Request for this, would be a very valuable addition.

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