Added radio buttons helper
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 25 Feb 2010 21:12:39 +0000 (21:12 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 25 Feb 2010 21:12:39 +0000 (21:12 +0000)
includes/ui/ui_input.inc

index 13d39e63612d7525d132f834ab0ac7167c89571e..d963665f4cb7d42ce5a1d1a38ae6923d57ede79c 100644 (file)
@@ -362,7 +362,18 @@ function check_row($label, $name, $value=null, $submit_on_change=false, $title=f
 }
 
 //-----------------------------------------------------------------------------------
+function radio($label, $name, $value, $selected, $submit_on_change=false) {
 
+       if ($submit_on_change === true)
+               $submit_on_change = 
+                       "JsHttpRequest.request(\"_{$name}_update\", this.form);";
+
+       return "<input type='radio' name=$name value='$value' ".($selected ? "checked":'')
+           .($submit_on_change ? " onclick='$submit_on_change'" : '')
+               .">".($label ? $label : '');
+}
+
+//-----------------------------------------------------------------------------------
 function labelheader_cell($label, $params="")
 {
        echo "<td class='tableheader' $params>$label</td>\n";