Make htmlInstaller use edit control values, not contents.#14
Conversation
|
This is cool, but we really, really need a test for this before a merge. If you have hard time writing one I'd be happy to give it a shot this week. |
|
Also, please update CHANGELOG.md part of the request. Appreciated. |
htmlInstaller appears to be using the inner HTML contents of any <input type="text"> elements. It should use the value of those elements instead.
|
Hrm... the problem seems to be in the "convert the HTML form elements into control args" step, but there are no tests for that yet that I can see. I started to write a test based on UserControlUnitTests.TestUserControlEdit(), but realized that I can't specify an HTML file for the installer unless I compile it with InstallerLinker. It looks like htmlInstaller always looks either in the directory it runs from, or from an embedded resource. I'm not quite sure how to write a test for this without restructuring a lot more things, a task which is likely quite beyond my capability. |
|
I pushed a new branch text-value-bad showing what I was about to try. The test doesn't pass because htmlInstaller doesn't find index.html where I put it, and dotNetInstaller.exe will never pass the test since it doesn't know about HTML UIs. |
|
I am not saying it's going to be easy :) There's a .NET project called dotNetInstallerUnitTests under unittests that creates a configuration file, links it and runs it. That executes with either DNI or htmlInstaller, do a Start without a fix. There should be a way to reuse the value of a custom variable to signal an exit code via a component. So you could make a setup fail this way. With the fix it should read the value properly and return a 0 error code, succeeding. |
|
I worked at it tonight and got to commit 578b64e, but still isn't a passing test. It seems that when the UI level is silent, htmlInstaller.exe only populates user controls with whatever is in the config file. When the UI level is full, it uses values from the HTML. So if this test were running under full UI, it would pass, but since I'm using silent UI, it doesn't. I think the current behavior makes sense (use the configuration file for default values, then override them with HTML values when running in full UI mode). |
|
It takes a couple more auto-start options to get it to run in full UI, here're the changes. Should get you further. |
|
The test passes now. If I revert jennings/dotnetinstaller@5d1e417, the test fails, although it fails for a different reason than I expected. The installer just stays open, then the test fails when you manually close it. I'm not entirely sure why that difference in behavior exists. |
|
The installer stays open cause the command hangs. And it hangs because the edit field doesn't have a value (which is the bug) and so it tries to do Thanks so much for doing this work, much appreciated and merged. |
|
Thanks for the guidance with the test. |
|
Hi, thanks |
|
@AGho please ask the mailing list if what's in the CHM is not sufficient |
(This is an issue from CodePlex, issue 10447)
When using an
<input type="text">element in an HTML page, htmlInstaller does not populate values so they can be used by components.The sample configuration.xml has an element
<input type="text" id="TestValueFromHtml" />, but any value put in this box is not visible to components (the log says: "Setting user-defined edit value 'TestValueFromHtml'=")I think the solution is to use the element's value (
elt.get_value().to_string()) instead of it's HTML contents (elt.get_html(false)). This resolves the issue in my testing; the log file shows the value when calling the MSI component.configuration.xml
index.html