Пример #1
0
 /**
  * Generate Javascript code
  *
  * See {@link \ValidFormBuilder\ValidForm::toJs()}
  *
  * @internal
  * @param string $strCustomJs Optional custom javascript code to be executed at the same
  * time the form is initialized
  * @param array $arrInitArguments Only use this when initializing a custom client-side object. This is a flat array
  * of arguments being passed to the custom client-side object.
  * @param string $blnRawJs If set to true, the generated javascript will not be wrapped in a <script> element. This
  * is particulary useful when generating javascript to be returned to an AJAX response.
  * @return string Generated javascript
  */
 protected function __toJs($strCustomJs = "", $arrInitArguments = array(), $blnRawJs = false)
 {
     // Add extra arguments to javascript initialization method.
     if ($this->__currentpage > 1) {
         $arrInitArguments["initialPage"] = $this->__currentpage;
     }
     $arrInitArguments["confirmPage"] = $this->__hasconfirmpage;
     $strJs = "";
     $strJs .= "objForm.setLabel('next', '" . $this->__nextlabel . "');\n\t";
     $strJs .= "objForm.setLabel('previous', '" . $this->__previouslabel . "');\n\t";
     if (!empty($this->__nextclass)) {
         $strJs .= "objForm.setClass('next', '" . $this->__nextclass . "');\n\t";
     }
     if (!empty($this->__previousclass)) {
         $strJs .= "objForm.setClass('previous', '" . $this->__previousclass . "');\n\t";
     }
     if (strlen($strCustomJs) > 0) {
         $strJs .= $strCustomJs;
     }
     return parent::__toJs($strJs, $arrInitArguments, $blnRawJs);
 }