All Apps and Add-ons

How to use the value of a text box defined in a Sideview Utils HTML module in other modules?



I have defined a datepicker in a Sideview Utils HTML module

<module name="HTML" >
          <param name="html"><![CDATA]

 <script src=""></script>
  <script src=""></script>
   $$(function() {
     $$( "#datepicker" ).datepicker();
 <p>Date: <input type="text" id="datepicker" name="datepicker" /></p>

How can we access this in other Sideview Utils modules?
For example:

<module name="Search"   autoRun="True" group="Moving Label Step Average" >
     <param name="search">index=re source="*step.csv"  date=$datepicker$</param>



Well, to be honest, it would be extremely difficult because this is not the way you want to do this, at all.

Backing up, there is a DateTime module in Sideview Utils (if you don't see it then you're on the ancient LGPL version and you should update to the free 3.X version here:

The DateTime module is configurable to allow just dates, or dates plus times to be selected. It can also be used in pairs thus to pick both start time and end time.

If DateTime isn't your cup of tea for some reason the way you would extend a sideview XML view with custom Javascript is through a customBehavior module. This allows for a much cleaner implementation, with JS living in application.js. You can find a docs page talking about customBehaviors if you go to Tools > Other Tools, then scroll down to the bottom and click the link you see there.

CustomBehaviors can be very simple or very complex but there are a lot of examples hidden away inside Sideview Utils.

One more note - in general you want to avoid the HTML module for custom stuff like this, because when the HTML module receives a push from upstream, all the HTML inside will be thrown away and rewritten. This almost always has crippling effects on custom code like this. In this case your JS would execute again, and even when the JS is off in application.js, recreating the HTML will usually reset the state as well as sever the relationship between the HTML in the page and the JS that's trying to modify it.

0 Karma