<?php
+//------------------------------------------------------------------------------
+// Seek for _POST variable with $prefix.
+// If var is found returns variable name with prefix stripped,
+// and null or -1 otherwise.
+//
+function find_submit($prefix, $numeric=true) {
+
+ foreach($_POST as $postkey=>$postval ) {
+ if (strpos($postkey, $prefix) === 0) {
+ $id = substr($postkey, strlen($prefix));
+ return $numeric ? (int)$id : $id;
+ }
+ }
+ return $numeric ? -1 : null;
+}
+
+//------------------------------------------------------------------------------
+//
+// Read numeric value from user formatted input
+//
function input_num($postname=null) {
if (!isset($_POST[$postname]))
return null;
function submit($name, $value, $echo=true)
{
+ default_focus($name);
$submit_str = "<input type=\"submit\" class=\"inputsubmit\" name=\"$name\" value=\"$value\">\n";
if ($echo)
echo $submit_str;
function button($name, $value, $onclick)
{
- echo "<input type=\"button\" class=\"inputsubmit\" name=\"$name\" value=\"$value\" onclick=\"$onclick\" />\n";
+ default_focus($name);
+ echo "<input type=\"button\" class=\"inputsubmit\" name=\"$name\" value=\"$value\" onclick=\"$onclick\" />\n";
}
function button_cell($name, $value, $onclick)
function check($label, $name, $value, $submit_on_change=false)
{
+ default_focus($name);
if ($label)
echo $label . " ";
function text_cells($label, $name, $value, $size="", $max="", $params="", $post_label="", $disabled="")
{
+ default_focus($name);
if ($label != null)
label_cell($label, $params);
echo "<td>";
function text_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null)
{
+ default_focus($name);
if (!isset($_POST[$name]) || $_POST[$name] == "")
{
if ($init)
$_POST[$name] = $init;
}
if ($use_date_picker)
- $post_label = "<a href=\"javascript:date_picker(document.forms[0].$name);\">"
+ $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.forms[0].$name);\">"
. " <img src='$path_to_root/themes/default/images/cal.gif' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
else
$post_label = "";
function textarea_cells($label, $name, $value, $cols, $rows, $params="")
{
+ default_focus($name);
if ($label != null)
echo "<td $params>$label</td>\n";
if ($value == null)
function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
{
+ default_focus($name);
echo "<tr><td>$label</td>\n";
echo "<td>";