Embedded View OnStartup script does consistently run on page open

For some background knowledge I am working on a form application. There is a table that displays the users submitted forms and the data within the form. When the user double clicks on a row in the table it will bring them to that form with the fields within the form initialized so they may edit that submission. I initially had it working and displayed nicely on desktop (used a flex container for the view), but not for mobile. I decided to make a mobile view and a view that utilized a breakpoint container that would display the desktop and mobile view according to screen size through an embedded view component. However, now it seems as though the onStartup script for the views referenced within the embedded view components do not run when a user goes back and selects another form submission to edit. To preface, If I were to navigate directly to the desktop or mobile view this problem does not occur.

Form when OnStartup script runs:

Form when OnStartup script does not run:

Expected behavior of the onStartup event. You should be using a propertyChange event on the parameter value(s) driving the form.

Currently the only parameter being passed is the SubmissionID. Then within the OnStartUp script for the views referenced I utilize the SubmissionID within a query to initialize the form fields. Would I have to instead do that within the breakpoint container view and pass each field as a parameter to the embedded views?

Just move the logic from the startup script to a value change script on the parameter.

1 Like

Moving the script would be simplest, short term. But consider not scripting it at all--just use a named query binding in a view custom property to retrieve your data, supplying the submission ID in a binding. Then your form components can initialize themselves with an expression binding pointing at that custom property. (No scripting for anything but your save operation.)


Thank you for the suggestions, I will move the script for now and look into using a named query binding in the future.

That's what people say before not doing what they should do ;p

1 Like