Closed shawnbot closed 3 years ago
Size Change: +277 B (0%)
Total Size: 88.6 kB
Filename | Size | Change |
---|---|---|
dist/formio-sfds.css |
14 kB | -25 B (0%) |
dist/formio-sfds.standalone.js |
68.2 kB | +302 B (0%) |
Heads up to @hshaosf @nlsfds: this will be going out in the next release so you should be able to link to pages and/or components in form previews, but not (yet) on sf.gov.
This PR addresses FM-22 by adding support for the following form options (the second argument to
Formio.createForm()
):page
takes either a 1-based index or a component key and attempts to set the current page of the form accordingly.focus
takes a component key and attempts to give it focus.There are a couple of extra considerations to make these work for cases that formio.js doesn't handle natively:
page
key resolves to something other than a page component it gives it focus instead, which sets the page automatically. (This is easier than attempting to figure out which page contains the component)focus
key resolves to a page component we route to it withform.setPage(index)
instead. (Page components can't receive focus in formio.js)I think there's value in having them separate, but I'm also willing to be convinced otherwise and just have a single codepath for "focusing" either a specific component or page.
Examples
page
option to the feedback form previewIn order to make this work on sf.gov proper (later, I think, since this is currently only something we need for testing), we'll need to handle parsing either the query string or hash and merging (w/validation!) those options into the ones that we pass the form here.