I am developing an add-on that adds a custom alert action. I've built a custom HTML fragment (as described in the custom alert UI docs), and it mostly operates as expected, but for one major issue: despite the fact that my HTML specifies default values for the input fields, the fields appear blank.
So, for example, I've got an input like this:
<input type="text" name="action.myapp.param.some_param" id="some_param" value="Default text I expect to see">
When I bring up the UI, the text box appears, but is blank. Inspecting the DOM reveals that the value attribute is indeed on the <input> element as expected, but the text just isn't showing up. I'm not sure if some bit of JavaScript I can't find is clearing it out or what, but this behavior seems incorrect.
The same problem affects <textarea> inputs, which fail to show the text occurring between <textarea> tags as expected.
I looked through all the other apps and add-ons on Splunkbase that provide custom alert actions, and none of them have HTML that specifies a value for a text input or textarea, so I guess either I'm the first one to hit this issue or others have worked around it.
The problem only affects the default values I wish to present. Once I actually enter text into the form and save it, it round-trips just fine. Well, almost; when I open the alert again after editing it, the text input fields do display the values I had saved. However, inspecting the DOM still shows the original default values in the HTML. I guess what's going on is that it's simply ignoring the value attribute (and its equivalent for <textarea> ), and clobbering it with whatever's saved. In the case where the "saved" values are in fact empty (the first time the form is displayed), we get the problem I've described. I'd love to see this fixed, unless someone can explain to me how the current behavior is correct.
... View more