Revision: 2303
http://mrbs.svn.sourceforge.net/mrbs/?rev=2303&view=rev
Author: cimorrison
Date: 2012-06-25 15:47:27 +0000 (Mon, 25 Jun 2012)
Log Message:
-----------
- Fixed bug preventing the display of the brief description when editing an
existing booking
- Fixed bug relating to mandatory integer fields
Modified Paths:
--------------
mrbs/trunk/web/edit_entry.php
mrbs/trunk/web/functions.inc
Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php 2012-06-21 15:54:26 UTC (rev 2302)
+++ mrbs/trunk/web/edit_entry.php 2012-06-25 15:47:27 UTC (rev 2303)
@@ -647,12 +647,22 @@
// Otherwise output a text input
else
{
- // If it's a mandatory field then add the HTML5 required and pattern
attributes
- $attributes = (isset($is_mandatory_field["entry.$key"]) &&
$is_mandatory_field["entry.$key"]) ? 'type="text" required pattern="' .
REGEX_TEXT_POS . '"' : NULL;
- if (($field['nature'] == 'integer') && ($field['length'] > 2))
+ $is_integer_field = ($field['nature'] == 'integer') && ($field['length'] >
2);
+ if ($is_integer_field)
{
- $attributes .= 'type="number" step="1"';
+ $attributes = 'type="number" step="1"';
}
+ else
+ {
+ $attributes = 'type="text"';
+ }
+ if (isset($is_mandatory_field["entry.$key"]) &&
$is_mandatory_field["entry.$key"])
+ {
+ $attributes .= ' required';
+ // 'required' is not sufficient for strings, because we also want to
make sure
+ // that the string contains at least one non-whitespace character
+ $attributes .= ($is_integer_field) ? '' : ' pattern="' . REGEX_TEXT_POS
. '"';
+ }
generate_input($label_text, $var_name, $value, $disabled, NULL,
$attributes);
}
if ($disabled)
Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc 2012-06-21 15:54:26 UTC (rev 2302)
+++ mrbs/trunk/web/functions.inc 2012-06-25 15:47:27 UTC (rev 2303)
@@ -394,7 +394,7 @@
$html .= (isset($maxlength)) ? " maxlength=\"$maxlength\"" : '';
// Don't give an empty string if it's a number as that's not a valid
floating point number
// and will fail HTML5 validation
- if (isset($attributes) && (strpos($attributes, 'type="number"') !== FALSE)
&& ($value != ''))
+ if (!isset($attributes) || (strpos($attributes, 'type="number"') === FALSE)
|| ($value != '') )
{
$html .= " value=\"" . htmlspecialchars($value) . "\"";
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits