<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Drop down box]]></title><description><![CDATA[<p dir="auto">hi, i've seen code for a drop down selection box...</p>
<p dir="auto"><a href="http://mango.serotoninsoftware.com/forum/posts/list/598.page" rel="nofollow ugc">http://mango.serotoninsoftware.com/forum/posts/list/598.page</a></p>
<p dir="auto">which i've been able to implement, but instead of numbers, i'd like text, which after selection, writes a corresponding numberic value to the point variable.</p>
<p dir="auto">what do i need to change?</p>
<p dir="auto">thanks</p>
<p dir="auto">Neil</p>
]]></description><link>https://forum.mango-os.com/topic/607/drop-down-box</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 15:18:30 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/607.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 Oct 2010 15:06:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Drop down box on Sat, 30 Oct 2010 17:55:40 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">It needs to have the "selected" in the option to be sync. The basic structure is this.</p>
<pre><code>
&lt;select onChange='somefunction()'&gt;
&lt;option value=1 &gt; one &lt;/option&gt;
&lt;option value=2 selected &gt; two &lt;/option&gt;
&lt;option value=3 &gt; three &lt;/option&gt;
&lt;/select&gt;

</code></pre>
<p dir="auto">I used the loop to to write the selected into correct option (and not to write tens of times the same code)</p>
<p dir="auto">Here is an example without any loops.</p>
<pre><code>
//Simple Select example
var s="";

s+="&lt;select  onChange='mango.view.setPoint("+ point.id +", \""+ pointComponent.id +"\", this.options[this.selectedIndex].value )'&gt;";
 
s+= "&lt;option value=1";
if (value == 1 ) { s+= " selected ";}
s+= "&gt; one &lt;/option&gt;";

s+= "&lt;option value=2";
if (value == 2 ) { s+= " selected ";}
s+= "&gt; two &lt;/option&gt;";

s+= "&lt;option value=3";
if (value == 3 ) { s+= " selected ";}
s+= "&gt; three &lt;/option&gt;";

s+= "&lt;option value=4";
if (value == 4 ) { s+= " selected ";}
s+= "&gt; four &lt;/option&gt;";

s+="&lt;/select&gt;";

return s;


</code></pre>
<p dir="auto">I will put some more select examples from my views into the other topic.</p>
<p dir="auto">BR<br />
-Jokke</p>
]]></description><link>https://forum.mango-os.com/post/4779</link><guid isPermaLink="true">https://forum.mango-os.com/post/4779</guid><dc:creator><![CDATA[Jokke]]></dc:creator><pubDate>Sat, 30 Oct 2010 17:55:40 GMT</pubDate></item><item><title><![CDATA[Reply to Drop down box on Sat, 30 Oct 2010 11:15:31 GMT]]></title><description><![CDATA[<p dir="auto">i've been fumbling.... and got this...</p>
<p dir="auto">var s="";<br />
s+="&lt;select name='mode'"<br />
s+="onchange='mango.view.setPoint("+ <a href="http://point.id" rel="nofollow ugc">point.id</a> +", ""+ <a href="http://pointComponent.id" rel="nofollow ugc">pointComponent.id</a> +"", this.selectedIndex)'&gt;'&gt;"<br />
s+="&lt;option value=0&gt;local&lt;/option&gt;"<br />
s+="&lt;option value=1&gt;remote&lt;/option&gt;"<br />
s+="&lt;/select&gt;";<br />
return s;</p>
<p dir="auto">whilst it works, unless the object selection is changed, the present value is not sync'd the real value..</p>
<p dir="auto">i saw the for loop in jokke example... but i ended up with 4 entries instead of 2...</p>
<p dir="auto">i tried to create a var called 'newval' and make that equal value (from the point value) and then modify the onchange to set a var, i.e. newval=this.selectedIndex</p>
<p dir="auto">an then at the end of the script update the mango.view.setpoint bit...</p>
<p dir="auto">couldn't get it to work though..</p>
<p dir="auto">also, if possible... might be nice to modify the whole thing so that a button [OK] 'onclick' causes the mango.view.setpoint bit to be updated, allowing the user to explore the choices for committing</p>
]]></description><link>https://forum.mango-os.com/post/4778</link><guid isPermaLink="true">https://forum.mango-os.com/post/4778</guid><dc:creator><![CDATA[skiv71]]></dc:creator><pubDate>Sat, 30 Oct 2010 11:15:31 GMT</pubDate></item><item><title><![CDATA[Reply to Drop down box on Sat, 30 Oct 2010 03:04:24 GMT]]></title><description><![CDATA[<p dir="auto">Something like this... Change:</p>
<pre><code>    s+= "&amp;lt;option value="+ i;
    if (value == i) { s+= " selected ";}
    s+= "&amp;gt;"+i+ "&amp;gt;&amp;lt;/option&amp;gt;";

</code></pre>
<p dir="auto">... to:</p>
<pre><code>
    s+= "&amp;lt;option value=1&amp;gt;my label for 1&amp;lt;/option&amp;gt;";
    s+= "&amp;lt;option value=2&amp;gt;my label for 2&amp;lt;/option&amp;gt;";
    s+= "&amp;lt;option value=3&amp;gt;my label for 3&amp;lt;/option&amp;gt;";

</code></pre>
<p dir="auto">... and do what you need to do to default the selection (i.e. the "selected" attribute).</p>
]]></description><link>https://forum.mango-os.com/post/4776</link><guid isPermaLink="true">https://forum.mango-os.com/post/4776</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Sat, 30 Oct 2010 03:04:24 GMT</pubDate></item></channel></rss>