Very useful examples, I would like to set an RTC clock using two select combobox: Hours 0-23 and Minutes 0-59.
The datapoint must be set in seconds, so I need two combos performing some scripting like get the value of hours3600 plus minutes60.
I am trying but could not do it yet.
Here is my code, it works outside mango, but could not set the datapoint from this, anyone could help?
<script language="JavaScript">
function checar() {
campo1 = document.form.select1;
campo2 = document.form.select2;
if(campo1.value!="") {
valor1=campo1.value;
} else {
valor1="";
}
if(campo2.value!="") {
valor2=campo2.value;
} else {
valor2="";
}
um = valor1*3600; // hour to seconds
dois = valor2*60; // minutes to seconds
totalSec = um+dois;
if(um=="" && dois=="") {
document.form.total.value="";
} else {
document.form.total.value=totalSec;
//mango.view.setPoint("+ point.id +", \""+ pointComponent.id +"\", "+totalSec+" )'>";
}
}
</script>
<form name="form">
<select name="select1" onChange="checar()">
<option></option>
<option value="1">1</option>
<option value="0">...</option>
<option value="23">23</option>
</select>
<select name="select2" onChange="checar()">
<option></option>
<option value="1">1</option>
<option value="0">...</option>
<option value="59">59</option>
</select>
<input type="text" name="total" value="">
</form>