added calendar

This commit is contained in:
Roland Gruber 2013-02-09 13:59:17 +00:00
parent 7ed038c20b
commit 32adc71104
1 changed files with 38 additions and 16 deletions

View File

@ -382,39 +382,43 @@ class htmlTableRow extends htmlElement {
class htmlInputField extends htmlElement { class htmlInputField extends htmlElement {
/** unique field name */ /** unique field name */
private $fieldName; protected $fieldName;
/** field value */ /** field value */
private $fieldValue; protected $fieldValue;
/** field size (default 30) */ /** field size (default 30) */
private $fieldSize = 30; protected $fieldSize = 30;
/** field max length (default 255) */ /** field max length (default 255) */
private $fieldMaxLength = 255; protected $fieldMaxLength = 255;
/** on keypress event */ /** on keypress event */
private $onKeyPress = null; protected $onKeyPress = null;
/** password field */ /** password field */
private $isPassword = false; protected $isPassword = false;
/** enabled or disabled */ /** enabled or disabled */
private $isEnabled = true; protected $isEnabled = true;
/** indicates that the value should be saved in obfuscated form */ /** indicates that the value should be saved in obfuscated form */
private $obfuscate = false; protected $obfuscate = false;
/** indicates that this field should not automatically be saved in the self service or server profile */ /** indicates that this field should not automatically be saved in the self service or server profile */
private $transient = false; protected $transient = false;
/** required field */ /** required field */
protected $required = false; protected $required = false;
/** validation rule */ /** validation rule */
private $validationRule = null; protected $validationRule = null;
/** enable autocomplete */ /** enable autocomplete */
private $autocomplete = false; protected $autocomplete = false;
/** multiple values in one field */ /** multiple values in one field */
private $autocompleteMultiValue = false; protected $autocompleteMultiValue = false;
/** separator expression for multiple values in one field */ /** separator expression for multiple values in one field */
private $autocompleteMultiValueSeparatorExp = null; protected $autocompleteMultiValueSeparatorExp = null;
/** separator for multiple values in one field */ /** separator for multiple values in one field */
private $autocompleteMultiValueSeparator = null; protected $autocompleteMultiValueSeparator = null;
/** autocompletion suggestions */ /** autocompletion suggestions */
private $autocompleteValues = array(); protected $autocompleteValues = array();
/** autocomplete start at this input length */ /** autocomplete start at this input length */
private $autocompleteMinLength = 1; protected $autocompleteMinLength = 1;
/** show calendar */
protected $showCalendar = false;
/** calendar format */
protected $calendarFormat = '';
/** /**
* Constructor * Constructor
@ -533,6 +537,14 @@ class htmlInputField extends htmlElement {
echo '});'; echo '});';
echo "</script\n>"; echo "</script\n>";
} }
if ($this->showCalendar) {
echo '<script type="text/javascript">
jQuery(function() {
$("#' . $this->fieldName . '").datepicker({ dateFormat: "' . $this->calendarFormat . '"});
});
</script>
';
}
if ($this->transient) { if ($this->transient) {
return array(); return array();
} }
@ -646,6 +658,16 @@ class htmlInputField extends htmlElement {
public function setOnKeyPress($onKeyPress) { public function setOnKeyPress($onKeyPress) {
$this->onKeyPress = $onKeyPress; $this->onKeyPress = $onKeyPress;
} }
/**
* Shows a calendar when the field is selected.
*
* @param String $format calendar format (e.g. yyyy-mm-dd)
*/
public function showCalendar($format) {
$this->showCalendar = true;
$this->calendarFormat = $format;
}
} }