From 2354faf7ac87f191b7d4906e40e82172199accb9 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 12 Jun 2008 12:52:01 -0400 Subject: add instructions to each form entry in forms darcs-hash:20080612165201-84dde-1abc45a0b2fd24002bc6f3449e9fc521d4f02eac.gz --- lib/util.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index 5c55fcda9..c64cd5979 100644 --- a/lib/util.php +++ b/lib/util.php @@ -261,7 +261,7 @@ function common_menu_item($url, $text, $title=NULL, $is_selected=false) { common_element_end('li'); } -function common_input($id, $label, $value=NULL) { +function common_input($id, $label, $value=NULL,$instructions=NULL) { common_element_start('p'); common_element('label', array('for' => $id), $label); $attrs = array('name' => $id, @@ -271,6 +271,9 @@ function common_input($id, $label, $value=NULL) { $attrs['value'] = htmlspecialchars($value); } common_element('input', $attrs); + if ($instructions) { + common_element('span', 'input_instructions', $instructions); + } common_element_end('p'); } @@ -281,13 +284,16 @@ function common_hidden($id, $value) { 'value' => $value)); } -function common_password($id, $label) { +function common_password($id, $label, $instructions=NULL) { common_element_start('p'); common_element('label', array('for' => $id), $label); $attrs = array('name' => $id, 'type' => 'password', 'id' => $id); common_element('input', $attrs); + if ($instructions) { + common_element('span', 'input_instructions', $instructions); + } common_element_end('p'); } @@ -301,7 +307,7 @@ function common_submit($id, $label) { common_element_end('p'); } -function common_textarea($id, $label, $content=NULL) { +function common_textarea($id, $label, $content=NULL, $instructions=NULL) { common_element_start('p'); common_element('label', array('for' => $id), $label); common_element('textarea', array('rows' => 3, @@ -309,6 +315,9 @@ function common_textarea($id, $label, $content=NULL) { 'name' => $id, 'id' => $id), ($content) ? $content : ' '); + if ($instructions) { + common_element('span', 'input_instructions', $instructions); + } common_element_end('p'); } -- cgit v1.2.3-54-g00ecf