108 if ($addtoken !=
false) {
134 return $encode ? htmlspecialchars($this->title, ENT_QUOTES) :
$this->title;
160 return $encode ? htmlspecialchars($this->name, ENT_QUOTES) :
$this->name;
172 $this->action = $value;
185 return $encode ? htmlspecialchars(str_replace(
'&',
'&', $this->action), ENT_QUOTES) :
$this->action;
195 return (strtolower($this->method) ==
'get') ?
'get' :
'post';
209 $this->elements[] = $formElement;
212 $required_elements = $formElement->getRequired();
213 $count = count($required_elements);
215 $this->required[] = $required_elements[
$i];
220 $this->required[] = $formElement;
238 foreach ($this->elements as $ele) {
267 $ret[] = $ele->getName();
285 if (
$name == $ele->getName()) {
304 if (is_object($ele)) {
305 $ele->setValue($value);
318 if (is_array($values) && !empty($values)) {
323 $name = $ele->getName();
325 $ele->setValue($values[$name]);
342 return $ele->getValue($encode);
359 $name = $ele->getName();
361 $values[
$name] = $ele->getValue($encode);
391 $this->summary = strip_tags(
$summary);
402 $extra = empty($this->extra) ?
'' :
' ' . implode(
' ', $this->extra);
415 $this->required[] = $formElement;
435 abstract public function render();
475 $js .=
"\n<!-- Start Form Validation JavaScript //-->\n<script type='text/javascript'>\n<!--//\n";
478 $js .=
"function xoopsFormValidate_{$formname}() { var myform = window.document.{$formname}; ";
482 $js .= $ele->renderValidationJS();
484 $js .=
"return true;\n}\n";
486 $js .=
"//--></script>\n";
487 $js .=
"<!-- End Form Validation JavaScript //-->\n";
510 $ele_name = $ele->getName();
511 $ele_description = $ele->getDescription();
512 $n = $ele_name ? $ele_name :
$i;
514 $elements[$n][
'caption'] = $ele->getCaption();
516 $elements[$n][
'hidden'] = $ele->isHidden();
517 $elements[$n][
'required'] = $ele->isRequired();
518 if ($ele_description !=
'') {
519 $elements[$n][
'description'] = $ele_description;
523 $tpl->assign($this->
getName(), array(
526 'extra' =>
'onsubmit="return xoopsFormValidate_' . $this->
getName() .
'();"' . $this->
getExtra(),
527 'javascript' => $js,
'elements' =>
$elements