Friday, 4 September 2020

(Nodejs/keystonejs) How to re-select a user selected option element after form submission error?

Job Role *

User submits a form and gives erroneous input for a field (bad email, eg). How can the user selected options be re-selected when the page re-renders? It's simple with strings - here is an input refilled with the value from the submission. I've thought about adding a conditional to the option tag (if X in list, then option becomes selected) but haven't found anything indicating this is possible. Is there a better way to achieve this other than passing an array to JS frontend and making the selections there? This way seems like overkill

Submitted September 05, 2020 at 12:56AM by AS1272

No comments:

Post a Comment