2014-11-20 04:26 PM
Has anybody managed to get the #input SSI to hand over a value for anything but display?
I'm trying to figure out how to set some controls (sliders, check boxes...) based on values that will be provided by my micro by having them prompted for rather than generating html at run time.I've tried things like using #input in a script:window.onload = function() { var blah = <!--#input -->; var value_display = document.getElementById(''value_display''); value_display.value=blah;}or setting up a widget directly:<input id=''slider'' type=''range'' min=''12'' max=''50'' value=''12'' step=''2'' id=''slider'' ><br>
Value: <input type=''text'' id=''value_display'' value=<!--#input --> >But none of it works.Ideas?2014-11-21 10:41 AM
Progress!
Since the SSI tag <!--#input --> ends up looking like a comment in an HTML page, and the substitution that the SSI engine in the SPWF01S performs gives you results like ''<!--#input -->42'' (where your input was 42), the trick is to use javascript to grab a substring after trimming off the SSI tag, thus (ignore my lack of style, I've been working with javascript for 2 days now):
<!DOCTYPE html>
<html><head><title>#input parse test</title></head><script type=''text/javascript''>window.onload = function() { var blah = '<!--#input -->'.substr(14) var value_display = document.getElementById(''value_display''); value_display.value=blah; document.getElementById(''slider'').value = value_display.value; }</script> <body> <input id=''slider'' type=''range'' min=''12'' max=''50'' value=''12'' step=''2'' id=''slider'' ><br> Value: <input type=''text'' id=''value_display'' value=''12'' ></body></html>I believe that there is a basic problem with the SSI system in the SPWF01S modules though; if you need more than one value on a page you put in more than one <!--#input --> tag and the micro, on the serial port, will get prompted with an index indicating which value on the screen is asking for data. That's good, but what happens when you have more than one screen asking for data? The first tag on each screen will ask for data using the same index. You need to know the context of which screen is currently being displayed.Could the firmware development group add a parameter to the #input tag so that I can control the index being sent on the +WIND:56 request for input? That way, when I use multiple web pages, the requests for input can be context free, making the parser on the micro side much easier.2014-11-21 11:00 AM
Which FW version are you using?
There is already an index/counter into +WIND:56 indication, showing the number of the current message required as input. Is it what you need? j2014-11-21 02:14 PM
I'm using 140805, and yes there is an index/counter, but:
page1.html - has a #input - sends +WIND:65:...:1:page2.html - has two #input - sends +WIND:65:...:1:Without the micro knowing if the module is displaying page 1 or page 2, there is no context to know what to send to the module.If we could say <!--#input 99--> and it would send +WIND:65:..:99: , then the parser could be simple.2014-11-22 03:34 AM
Clear. I got your point.
We'll take care of your feedback. Thanks j