Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pre-populate form values? #14

Open
cyberkero opened this issue Aug 20, 2014 · 1 comment
Open

How to pre-populate form values? #14

cyberkero opened this issue Aug 20, 2014 · 1 comment

Comments

@cyberkero
Copy link

Is pre-populate from values is difficult or any example is available?

@davidmoten
Copy link
Owner

Yep, prepopulation is a difficult problem to perform generically but for individual forms is not necessarily hard. It depends on the complexity of your schema.

For starters for generic prepopulation the javascript code would need to parse and understand the schema so that it can understand how the input xml relates to the form. All of the schema parsing at the moment happens in the generation step in scala code which is much easier to manage. I've no intention of doing this stuff in javascript, so generic prepopulation is currently a dead end. If someone has ideas then would be good to hear them.

An example is not available, but parsing xml in javascript is not hard. You might choose to pass the input xml broken up into parameters in the url or have the form call a webservice to get them. At that point for an already generated form you could put in extraScript to load data into the html document using jquery. As the form is already generated you know the ids of the elements to refer to. It gets tricky with repeated elements as you can imagine but for simple forms this technique is not hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants