<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom JavaScript form gets resetted in SimpleXML in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171521#M10543</link>
    <description>&lt;P&gt;Your tip seems to be a solution, thank you! I tried to reload my page about 10-15 times, and I didn't see a single checkbox getting resetted.&lt;/P&gt;

&lt;P&gt;Could you point me to an explanation of "simplexml/ready!" thing, please?&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2014 08:33:13 GMT</pubDate>
    <dc:creator>npichugin</dc:creator>
    <dc:date>2014-03-05T08:33:13Z</dc:date>
    <item>
      <title>Custom JavaScript form gets resetted in SimpleXML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171519#M10541</link>
      <description>&lt;P&gt;Hello, everyone!&lt;/P&gt;

&lt;P&gt;I'm trying to create a Splunk 6 SimpleXML dashboard with an &amp;lt;html&amp;gt; within a row. This html snippet contains a pretty simple form with a set of checkboxes and a submit button. The form should validate and process checkbox states and send it to an external web service.&lt;/P&gt;

&lt;P&gt;I tried to do the following:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Insert a script="myscript.js" parameter into a toplevel &amp;lt;dashboard&amp;gt; tag&lt;/LI&gt;
&lt;LI&gt;In myscript.js, I write:&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;CODE&gt;require(['jquery'], function($) {&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;... functions ...&lt;/P&gt;

&lt;P&gt;$(document).ready(function() {&lt;BR /&gt;
    $('#myform').submit(submit_func)&lt;BR /&gt;
    load_checkbox_states_from_external_source();&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;});&lt;BR /&gt;
&lt;/P&gt;

&lt;P&gt;The problem is that checkboxes' states are not always loaded, and submit button is not always able to submit information (clicking on it just doesn't call any function at all). I checked everything - all functions are getting called and working good, but then some mysterious force resets all checkboxes' states and button's handler back to default. Calling these two functions with a 1 second timeout seems to help, but it isn't a nice and reliable solution.&lt;/P&gt;

&lt;P&gt;What do you think, splunkers, what should I do here?&lt;/P&gt;

&lt;P&gt;P.S. it seems that Advanced XML does not have this issue, but I do want to use Simple XML, because every other dashboard is written in Simple XML and I want to keep look&amp;amp;feel consistent throughout the app.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2014 12:16:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171519#M10541</guid>
      <dc:creator>npichugin</dc:creator>
      <dc:date>2014-03-03T12:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom JavaScript form gets resetted in SimpleXML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171520#M10542</link>
      <description>&lt;P&gt;Try adding "simplexml/ready!".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'jquery',
    'splunkjs/mvc/simplexml/ready!'
], function($) {
...
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Mar 2014 17:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171520#M10542</guid>
      <dc:creator>nfilippi_splunk</dc:creator>
      <dc:date>2014-03-04T17:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom JavaScript form gets resetted in SimpleXML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171521#M10543</link>
      <description>&lt;P&gt;Your tip seems to be a solution, thank you! I tried to reload my page about 10-15 times, and I didn't see a single checkbox getting resetted.&lt;/P&gt;

&lt;P&gt;Could you point me to an explanation of "simplexml/ready!" thing, please?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 08:33:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-JavaScript-form-gets-resetted-in-SimpleXML/m-p/171521#M10543</guid>
      <dc:creator>npichugin</dc:creator>
      <dc:date>2014-03-05T08:33:13Z</dc:date>
    </item>
  </channel>
</rss>

