submitOnChange always produces blank page?

I'm a little stymied how I'm supposed to use submitOnChange in dynamicPages. I found a thread from a couple years ago talking about how doing complex processing could cause a page to fail, but it seems like any submitOnChange input leads to a blank page for me.

Here's a test app:

definition (
    name: "submitOnChange Demo", namespace: "evequefou", author: "Mike Bishop", description: "Why does this break?",
    importUrl: "TBD",
    category: "My Apps",
    iconUrl: "",
    iconX2Url: ""

preferences {
    page(name: "mainPage")

Map mainPage() {
    dynamicPage(name: "Main Page", title: "Holiday Lighting", install: true, uninstall: true) {
        section("Options") {
            input "thisName", "text", title: "Name this App", submitOnChange: true
            if(thisName) app.updateLabel("${thisName}")
            input "device", "capability.colorControl", title: "RGB light", multiple: false, submitOnChange: true

Typing text in the text input and then moving focus anywhere turns the page blank. Choosing a device in the device input and then clicking anywhere turns the page blank. If I exit and re-enter the app, it appears that the values from the inputs are saved -- though the name update doesn't run until the app loads that second time -- but surely that's not the intended mechanic.

Is submitOnChange deprecated? Is there a different mechanism I should use to add more inputs based on what's already entered? More generally, is there documentation somewhere of the dynamicPage, section, input, href, etc. calls that are used in creating an app? I'm cribbing a lot from other apps, but only about 80% understanding what I'm taking from them.

I think this is the problem. I'm not aware of any "official" documentation on the matter but assume that this name cannot contain spaces, and I always follow Groovy variable name conventions when naming it, something like mainPage. This seems to have fixed the problem for me. (I don't think this is really related to submitOnChange but may have something to do with how the hub handles a hit to the URL that gets displayed based on the page name, which a submit will basically refresh.)

1 Like

Indeed, that seems to be it! Would it be unreasonable to wish for a more descriptive error message -- or indeed, any error message?

Would need to be changed in the compiler, so may not be in HE control.

Download the Hubitat app