18 require_once dirname(__FILE__).
'/../../form_question/form_question.inc';
72 $width = $this->
attr(
'width');
73 $max = $this->
attr(
'max');
74 $extras = $this->
attr(
'extra');
75 $name_a =
'q'.$this->id;
76 $name_b =
'q'.$this->id.
'_2';
79 $extras_a = $extras.
' id="'.str_replace(
':',
'_', $name_a).
'"';
80 $extras_b = $extras.
' id="'.str_replace(
':',
'_', $name_b).
'"';
82 if ($this->
attr(
'tabindex')) {
83 $extras_a .=
' tabindex="'.$this->attr(
'tabindex').
'"';
84 $extras_b .=
' tabindex="'.$this->attr(
'tabindex').
'"';
87 $value = $this->
attr(
'default');
90 password_box($name_a, $value, $width, $max, $extras_a);
91 if ($this->
attr(
'verify')) {
93 password_box($name_b, $value, $width, $max, $extras_b);
95 $html = ob_get_contents();
123 if (is_null($answer)) $answer = $this->
getValue();
127 if ($this->
attr(
'verify') && isset($this->_tmp[
'verify_value']) && ($answer != $this->_tmp[
'verify_value'])) {
128 $this->failed_rules[] = translate(
'core_form_password_entered_differently', $this->
attr(
'name'));
130 if (strlen($answer) < $this->
attr(
'min')) {
131 $this->failed_rules[] = translate(
'core_form_password_length_>=', $this->
attr(
'name'), $this->
attr(
'min'));
133 if (strlen($answer) > $this->
attr(
'max')) {
134 $this->failed_rules[] = translate(
'core_form_password_length_<=', $this->
attr(
'name'), $this->
attr(
'max'));
137 if (!empty($this->failed_rules))
return FALSE;
139 return parent::hasValidValue($answer, $mute_errors);
152 $name =
'q'.$this->id;
154 if (isset($_POST[$name])) {
156 if ($this->
attr(
'verify')) {
157 $this->_tmp[
'verify_value'] = $_POST[$name.
'_2'];
178 echo
'<text_q id="'.addslashes($this->
id).
'" name="'.htmlspecialchars($this->
attr(
'name')).
'">';
179 echo htmlspecialchars($answer);
182 $contents = ob_get_contents();
213 $this->value = $value;
214 if ($this->
attr(
'verify')) {
215 $this->_tmp[
'verify_value'] = $value;
242 return $this->
attr(
'name');