]> projects.mako.cc - yourule/blob - templates/_form_elements.tmpl
b365ce05579308c8e2abfd557d10de028731b7ea
[yourule] / templates / _form_elements.tmpl
1 <p><label for="units">Units:</label>
2 <select id="unitselector" name="units">
3 <option values="centimeters"#if $getVar('units', '') == 'centimeters'# selected="selected"'#end if#>centimeters</option>
4 <option value="inches"#if $getVar('units', '') == 'inches'# selected="selected"'#end if#>inches</option>
5 </select>
6 </p>
7
8 <p><label for="pixel_width">Screen width (in pixels):</label>
9 <input type="text" name="pixel_width" value="$getVar('pixel_width', None)" /></p>
10
11 <p><label for="unit_width"><em>Horizontal</em> screen width (in <span class="unittext">units</span>):</label>
12 <input type="text" name="unit_width" value="$getVar('unit_width', None)" /></p>
13
14 <script>
15 // simple chunk of javascript to handle changes
16 var unit_selector = $("unitselector");
17 function change_unit_text() {
18   var text_spans = document.getElementsByClassName('unittext');
19   for (i = 0; i < text_spans.length; i++) {
20     var text_span = text_spans[i];
21     Element.update(text_span, unit_selector.value);
22   }
23 }
24 change_unit_text();
25 Event.observe(unit_selector, 'change', change_unit_text);
26 </script>

Benjamin Mako Hill || Want to submit a patch?