You are viewing limited content. For full access, please sign in.

Question

Question

Saving changes to HTML

asked on November 22, 2022

I can not figure out why this would not work. I have a form, the user picks some options, I then check those options and append a <div> depending on what they are. Works perfect. However, when I use 'Save to Repo' - it saves with none of the changes. How can I retain those changes?

0 0

Replies

replied on November 22, 2022 Show version history

Changes to HTML are not saved because HTML is not part of the data included in any web form submissions; this is true for any web forms, not just LF, and it makes a lot of sense when you consider that a client-side browser can manipulate the HTML however the user wants, so accepting those changes could cause a lot issues and even create security vulnerabilities.

If you want those changes to be reflected in the form saved to the repository, then you'll need to write a version of your code that can run on the read-only copy. Your scripts will still be triggered when the Save to Repository task runs, but the content of the form will be different.

For example, all of the input elements are converted into static content in div elements just like when you have a read only user task, so you'll need alternate code that can produce the same results from a read-only version.

Another option to investigate, if it is possible for your scenario, is to add pre-defined custom html elements to the form and use field rules to show/hide them based on the user selections because those rules will be applied in Save to Repository without any extra code.

2 0
replied on November 23, 2022

That makes sense. I was actually trying to avoid writing something that works on the read only version again haha, that was a learning experience I'd prefer to not repeat. I like the idea of the custom HTML elements and I'm going to give that a go today, thanks for the suggestion.

One of the things I'm trying to account for is that what needs to be conditionally shown will change based on who is filling the form out; I think I may have used an input element in a custom HTML element before and that saved with the added text - will post an update after giving it a go.

0 0
replied on November 23, 2022

didn't work, oh well.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.