18 require_once dirname(__FILE__).
'/../../form_question/form_question.inc';
72 $height = ($this->
attr(
'height')) ? $this->
attr(
'height') : 1;
73 $width = $this->
attr(
'width');
74 $max = $this->
attr(
'max');
75 $extras = $this->
attr(
'extra');
76 $name =
'q'.$this->id;
79 $extras = $extras.
' id="'.str_replace(
':',
'_', $name).
'"';
81 if ($this->
attr(
'tabindex')) {
82 $extras .=
' tabindex="'.$this->attr(
'tabindex').
'"';
89 text_box($name, $value, $width, $max, FALSE, $extras);
91 text_area($name, $value, $width, $height, $max, $extras);
93 $html = ob_get_contents();
121 if (is_null($answer)) $answer = $this->
getValue();
123 if ($this->
attr(
'is_required')) {
124 $req_rule = Array(
'rule_code' =>
'comparison',
'operator' =>
'!=',
'value' =>
'');
125 array_push($this->vars[
'rules'][
'value'], $req_rule);
128 $ok = parent::hasValidValue($answer, $mute_errors);
130 if ($this->
attr(
'is_required')) {
131 array_pop($this->vars[
'rules'][
'value']);
151 if ($this->
attr(
'is_required')) {
152 $req_rule = Array(
'rule_code' =>
'comparison',
'operator' =>
'!=',
'value' =>
'');
153 array_push($this->vars[
'rules'][
'value'], $req_rule);
156 $code = parent::generateJSCode();
158 if ($this->
attr(
'is_required')) {
159 array_pop($this->vars[
'rules'][
'value']);
177 return Array(
'regexp',
'comparison',
'numeric',
'found_in',
'contain',
'length',
'email',
'begins_with',
'ends_with');
194 echo
'<text_q id="'.addslashes($this->
id).
'" name="'.htmlspecialchars($this->
attr(
'name')).
'">';
195 echo htmlspecialchars($answer);
198 $contents = ob_get_contents();